Skip to content

Commit f2221d0

Browse files
committed
Make companion-module links in UnPickler
1 parent 7021570 commit f2221d0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/dotty/tools/dotc/core/pickling/UnPickler.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,16 @@ object UnPickler {
118118
denot.owner.thisType select denot.sourceModule
119119
else selfInfo
120120
if (!(denot.flagsUNSAFE is JavaModule)) ensureConstructor(denot.symbol.asClass, decls)
121+
122+
val scalacCompanion = denot.classSymbol.scalacLinkedClass
121123
if (denot.flagsUNSAFE is Module) {
122-
val scalacCompanion = denot.classSymbol.scalacLinkedClass
123124
val companionClassMethod = ctx.synthesizeCompanionMethod(nme.COMPANION_CLASS_METHOD, scalacCompanion, denot.classSymbol)
124125
if (companionClassMethod.exists)
125126
companionClassMethod.entered
127+
} else {
128+
val companionModuleMethod = ctx.synthesizeCompanionMethod(nme.COMPANION_MODULE_METHOD, scalacCompanion, denot.classSymbol)
129+
if (companionModuleMethod.exists)
130+
companionModuleMethod.entered
126131
}
127132

128133
denot.info = ClassInfo(denot.owner.thisType, denot.classSymbol, parentRefs, decls, ost)

0 commit comments

Comments
 (0)