diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/src/dotty/tools/dotc/Compiler.scala | 4 | ||||
-rw-r--r-- | compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala | 9 | ||||
-rw-r--r-- | compiler/src/dotty/tools/dotc/typer/RefChecks.scala | 3 |
3 files changed, 12 insertions, 4 deletions
diff --git a/compiler/src/dotty/tools/dotc/Compiler.scala b/compiler/src/dotty/tools/dotc/Compiler.scala index 1d319242b..f413fc902 100644 --- a/compiler/src/dotty/tools/dotc/Compiler.scala +++ b/compiler/src/dotty/tools/dotc/Compiler.scala @@ -48,9 +48,9 @@ class Compiler { List(new Pickler), // Generate TASTY info List(new FirstTransform, // Some transformations to put trees into a canonical form new CheckReentrant), // Internal use only: Check that compiled program has no data races involving global vars - List(new RefChecks, // Various checks mostly related to abstract members and overriding - new CheckStatic, // Check restrictions that apply to @static members + List(new CheckStatic, // Check restrictions that apply to @static members new ElimRepeated, // Rewrite vararg parameters and arguments + new RefChecks, // Various checks mostly related to abstract members and overriding new NormalizeFlags, // Rewrite some definition flags new ExtensionMethods, // Expand methods of value classes with extension methods new ExpandSAMs, // Expand single abstract method closures to anonymous classes diff --git a/compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala b/compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala index 258b7f234..e67b3f114 100644 --- a/compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala +++ b/compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala @@ -95,8 +95,8 @@ class ElimRepeated extends MiniPhaseTransform with InfoTransformer with Annotati assert(ctx.phase == thisTransformer) def overridesJava = tree.symbol.allOverriddenSymbols.exists(_ is JavaDefined) if (tree.symbol.info.isVarArgsMethod && overridesJava) - addVarArgsBridge(tree)(ctx.withPhase(thisTransformer.next)) - else + addVarArgsBridge(tree) + else tree } @@ -120,6 +120,11 @@ class ElimRepeated extends MiniPhaseTransform with InfoTransformer with Annotati .appliedToArgs(vrefs :+ TreeGen.wrapArray(varArgRef, elemtp)) .appliedToArgss(vrefss1) }) + + // Drop the override flag on the user-written method, only the added bridge + // is a real override. + original.copySymDenotation(initFlags = original.flags &~ Override).installAfter(thisTransformer) + Thicket(ddef, bridgeDef) } diff --git a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala index 23d05e087..e8ff7d572 100644 --- a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala +++ b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala @@ -766,6 +766,9 @@ class RefChecks extends MiniPhase { thisTransformer => override def phaseName: String = "refchecks" + // Needs to run after ElimRepeated for override checks involving varargs methods + override def runsAfter = Set(classOf[ElimRepeated]) + val treeTransform = new Transform(NoLevelInfo) class Transform(currentLevel: RefChecks.OptLevelInfo = RefChecks.NoLevelInfo) extends TreeTransform { |