-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Cannot access enum from dependency at runtime #7991
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
Comments
I would say this is duplication but its the most minimal |
Here's the output of
The issue is that
The backend should honor |
Actually, it works fine if both files are compiled together. So maybe it's not the backend's fault. |
Or maybe it is? The produced trees with types are exactly the same for More concretely, I ran:
The two outputs are exactly the same for Test_2. But the backend translates the call differently on separate compilation. I am mystified. |
Somebody else should take this over please. It looks like this will require some effort to figure out where it goes wrong. |
If we compile the two files together, the class file generated for
If we compile the two files separately, the class file generated for
The second is incorrect, as |
When we generate code for field access, somehow final def internalName(sym: Symbol): String = {
// For each java class, the scala compiler creates a class and a module (thus a module class).
// If the `sym` is a java module class, we use the java class instead. This ensures that we
// register the class (instead of the module class) in innerClassBufferASM.
// The two symbols have the same name, so the resulting internalName is the same.
val classSym = if (sym.isJavaDefined && sym.isModuleClass) sym.linkedClassOfClass else sym
getClassBTypeAndRegisterInnerClass(classSym).internalName
}
|
Top-level Dotty Enum classes have the flag JAVA_ACC_ENUM. We cannot tell from the flag whether a class is JavaDefined or not. The `moduleRoot` already has the flag `JavaDefined` set, it suffices to test the flag.
Fix #7991: don't set JavaDefined for Dotty Enum module class
minimized code
Num.scala
Test.scala
expectation
Should run
The text was updated successfully, but these errors were encountered: