File tree 1 file changed +10
-1
lines changed
src/dotty/tools/backend/jvm 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -632,7 +632,16 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
632
632
* True for module classes of modules that are top-level or owned only by objects. Module classes
633
633
* for such objects will get a MODULE$ flag and a corresponding static initializer.
634
634
*/
635
- def isStaticModuleClass : Boolean = sym.isStatic && (sym is Flags .Module )
635
+ def isStaticModuleClass : Boolean =
636
+ (sym is Flags .Module ) && {
637
+ // scalac uses atPickling here
638
+ // this would not work if modules are created after pickling
639
+ // for example by specialization
640
+ val original = toDenot(sym).initial
641
+ val validity = original.validFor
642
+ val shiftedContext = ctx.withPhase(validity.phaseId)
643
+ toDenot(sym)(shiftedContext).isStatic
644
+ }
636
645
637
646
def isStaticConstructor : Boolean = isStaticMember && isClassConstructor
638
647
You can’t perform that action at this time.
0 commit comments