File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
src/dotty/tools/dotc/core/unpickleScala2 Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -119,13 +119,17 @@ object Scala2Unpickler {
119
119
val scalacCompanion = denot.classSymbol.scalacLinkedClass
120
120
121
121
def registerCompanionPair (module : Symbol , claz : Symbol ) = {
122
- val companionClassMethod = ctx.synthesizeCompanionMethod(nme.COMPANION_CLASS_METHOD , claz, module)
123
- if (companionClassMethod.exists)
124
- companionClassMethod.entered
122
+ def registerCompanionMethod (name : Name , target : Symbol , owner : Symbol ) = {
123
+ if (! owner.unforcedDecls.lookup(name).exists) {
124
+ val companionMethod = ctx.synthesizeCompanionMethod(name, target, owner)
125
+ if (companionMethod.exists) {
126
+ companionMethod.entered
127
+ }
128
+ }
129
+ }
130
+ registerCompanionMethod(nme.COMPANION_CLASS_METHOD , claz, module)
125
131
if (claz.isClass) {
126
- val companionModuleMethod = ctx.synthesizeCompanionMethod(nme.COMPANION_MODULE_METHOD , module, claz)
127
- if (companionModuleMethod.exists)
128
- companionModuleMethod.entered
132
+ registerCompanionMethod(nme.COMPANION_MODULE_METHOD , module, claz)
129
133
}
130
134
}
131
135
You can’t perform that action at this time.
0 commit comments