Skip to content

Commit 61f1f4d

Browse files
committed
Companion methods should have Method flag.
1 parent 52d6ac3 commit 61f1f4d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/dotty/tools/dotc/core/Symbols.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,14 @@ trait Symbols { this: Context =>
161161
owner.thisType, modcls, parents, decls, TermRef.withSymAndName(owner.thisType, module, name)),
162162
privateWithin, coord, assocFile)
163163

164+
val companionMethodFlags = Flags.Synthetic | Flags.Private | Flags.Method
165+
164166
def synthesizeCompanionMethod(name: Name, target: SymDenotation, owner: SymDenotation)(implicit ctx: Context) =
165167
if (owner.exists && target.exists && !owner.isAbsent && !target.isAbsent) {
166168
val existing = owner.unforcedDecls.lookup(name)
167169

168170
existing.orElse{
169-
ctx.newSymbol(owner.symbol, name, Flags.Synthetic | Flags.Private, ExprType(target.typeRef))
171+
ctx.newSymbol(owner.symbol, name, companionMethodFlags , ExprType(target.typeRef))
170172
}
171173
} else NoSymbol
172174

0 commit comments

Comments
 (0)