When I define Wrapper as value class(extending AnyVal):
class Wrapper(val string: String) extends AnyVal
def wrapperHolder(w: Wrapper): {def wrapper: Wrapper} = new {
def wrapper: Wrapper = w
}
I have following compile error for wrapperHolder:
Error:(5, 22) Result type in structural refinement may not refer to a user-defined value class
def wrapper: Wrapper = w
- Why it doesn't work for value class?
来源:https://stackoverflow.com/questions/52678323/result-type-in-structural-refinement-may-not-refer-to-a-user-defined-value-class