You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"All values in an enumeration share a common, unique type defined as the Value type member of the enumeration (Value selected on the stable identifier path of the enumeration instance)."
But there is a type erasure within Enumeration class.
That can give an unexpected type error. Example:
X.Value and A.Value are different types. So the functions
defpp( z:X.Value) {}
defpp( z:A.Value) {}
should be different too, but you get a compile error:
error: double definition:
method pp:(z: A.Value)Unit and
method pp:(z: X.Value)Unit at line 34
have same typeaftererasure: (z: Enumeration#Value)Unitdefpp( z:A.Value) {}
@paulp said:
Yikes. I say it's time to admit Enumeration is a failed experiment and go back to the drawing board.
BTW if you like that workaround here's [http://scala-programming-language.1934581.n4.nabble.com/disambiguation-of-double-definition-resulting-from-generic-type-erasure-tp2327664p2327853.html a more refined version].
From the API Enumeration:
"All values in an enumeration share a common, unique type defined as the Value type member of the enumeration (Value selected on the stable identifier path of the enumeration instance)."
But there is a type erasure within Enumeration class.
That can give an unexpected type error. Example:
X.Value and A.Value are different types. So the functions
should be different too, but you get a compile error:
BTW I found a curious workaround
There is no compile error any more and the output shows
"X" and "A" as expected.
Frank
The text was updated successfully, but these errors were encountered: