Skip to content

Commit 535368f

Browse files
committed
actually check if a symbol is infix before failing with ToplevelDefCantBeInfix
1 parent ed64113 commit 535368f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Checking.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ object Checking {
555555
fail(CannotHaveSameNameAs(sym, cls, CannotHaveSameNameAs.CannotBeOverridden))
556556
sym.setFlag(Private) // break the overriding relationship by making sym Private
557557
}
558-
if sym.isWrappedToplevelDef && !sym.isType then fail(ToplevelDefCantBeInfix(sym))
558+
if sym.isWrappedToplevelDef && !sym.isType && sym.flags.is(Infix) then fail(ToplevelDefCantBeInfix(sym))
559559
checkApplicable(Erased,
560560
!sym.isOneOf(MutableOrLazy, butNot = Given) && !sym.isType || sym.isClass)
561561
checkCombination(Final, Open)

0 commit comments

Comments
 (0)