Skip to content

Commit af6d780

Browse files
committed
Streamline Typer#traverse
1 parent 9cbfad6 commit af6d780

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,15 +2132,13 @@ class Typer extends Namer
21322132
buf += inlineExpansion(mdef1)
21332133
// replace body with expansion, because it will be used as inlined body
21342134
// from separately compiled files - the original BodyAnnotation is not kept.
2135+
case mdef1: TypeDef if mdef1.symbol.is(Enum, butNot = Case) =>
2136+
enumContexts(mdef1.symbol) = ctx
2137+
buf += mdef1
2138+
case EmptyTree =>
2139+
// clashing synthetic case methods are converted to empty trees, drop them here
21352140
case mdef1 =>
2136-
import untpd.modsDeco
2137-
mdef match {
2138-
case mdef: untpd.TypeDef if mdef.mods.isEnumClass =>
2139-
enumContexts(mdef1.symbol) = ctx
2140-
case _ =>
2141-
}
2142-
if (!mdef1.isEmpty) // clashing synthetic case methods are converted to empty trees
2143-
buf += mdef1
2141+
buf += mdef1
21442142
}
21452143
traverse(rest)
21462144
}

0 commit comments

Comments
 (0)