-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unknown name for enum field with Scala.js #14488
Comments
Ah, yes, Work around: give explicit names to the fields: object LocationType extends Enumeration {
type LocationType = Value
val IP: LocationType = Value("IP")
val GPS: LocationType = Value("GPS")
} |
What would people think about releasing the support for |
This is the same logic that is used in the Scala.js compiler plugin for Scala 2. We catch ValDefs of the forms val SomeField = Value val SomeOtherField = Value(5) and rewrite them as val SomeField = Value("SomeField") val SomeOtherField = Value(5, "SomeOtherField") For calls to `Value` and `new Val` without name that we cannot rewrite, we emit warnings.
This is the same logic that is used in the Scala.js compiler plugin for Scala 2. We catch ValDefs of the forms val SomeField = Value val SomeOtherField = Value(5) and rewrite them as val SomeField = Value("SomeField") val SomeOtherField = Value(5, "SomeOtherField") For calls to `Value` and `new Val` without name that we cannot rewrite, we emit warnings.
This is the same logic that is used in the Scala.js compiler plugin for Scala 2. We catch ValDefs of the forms val SomeField = Value val SomeOtherField = Value(5) and rewrite them as val SomeField = Value("SomeField") val SomeOtherField = Value(5, "SomeOtherField") For calls to `Value` and `new Val` without name that we cannot rewrite, we emit warnings.
This is the same logic that is used in the Scala.js compiler plugin for Scala 2. We catch ValDefs of the forms val SomeField = Value val SomeOtherField = Value(5) and rewrite them as val SomeField = Value("SomeField") val SomeOtherField = Value(5, "SomeOtherField") For calls to `Value` and `new Val` without name that we cannot rewrite, we emit warnings.
This is the same logic that is used in the Scala.js compiler plugin for Scala 2. We catch ValDefs of the forms val SomeField = Value val SomeOtherField = Value(5) and rewrite them as val SomeField = Value("SomeField") val SomeOtherField = Value(5, "SomeOtherField") For calls to `Value` and `new Val` without name that we cannot rewrite, we emit warnings.
Compiler version(s)
scalac 3.1.1 + scala.js 1.9.0
Minimized code
Output
"<Unknown name for enum field #1 of class class scala.Enumeration$Val>"
Expectation
"GPS"
The text was updated successfully, but these errors were encountered: