Skip to content

Commit 0c3e520

Browse files
committed
Improve performance of ErasedDecls phase
1 parent 50ad597 commit 0c3e520

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

compiler/src/dotty/tools/dotc/transform/UnusedDecls.scala

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ class ErasedDecls extends MiniPhase with InfoTransformer {
4040

4141
/* Info transform */
4242

43-
override def transformInfo(tp: Type, sym: Symbol)(implicit ctx: Context): Type = tp match {
44-
case tp: ClassInfo =>
45-
if (tp.classSymbol.is(JavaDefined) || !tp.decls.iterator.exists(_.is(Erased))) tp
46-
else tp.derivedClassInfo(decls = tp.decls.filteredScope(!_.is(Erased)))
47-
case _ => tp
43+
override def transformInfo(tp: Type, sym: Symbol)(implicit ctx: Context): Type = {
44+
if (sym.is(JavaDefined) || sym.is(Scala2x)) tp
45+
else tp match {
46+
case tp: ClassInfo => tp.derivedClassInfo(decls = tp.decls.filteredScope(!_.is(Erased)))
47+
case _ => tp
48+
}
4849
}
4950
}

0 commit comments

Comments
 (0)