aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/transform
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2017-03-12 16:18:37 +0100
committerGuillaume Martres <smarter@ubuntu.com>2017-03-12 16:22:42 +0100
commit568b1e71d3767827e4a61cd93736ae3b318a6dce (patch)
tree5866f7ba49136cc17b64482a2a612949d4f3a0c2 /compiler/src/dotty/tools/dotc/transform
parente5e691ea2dd53abb64306b91bf172aaa8e2e6b9c (diff)
downloaddotty-568b1e71d3767827e4a61cd93736ae3b318a6dce.tar.gz
dotty-568b1e71d3767827e4a61cd93736ae3b318a6dce.tar.bz2
dotty-568b1e71d3767827e4a61cd93736ae3b318a6dce.zip
ElimRepeated: Do not use installAfter
This was a mistake introduced in the previous commit, installAfter is only safe to use in `IdentityDenotTransformer` phases, otherwise it means that the phase denotation transformer is not run at all for this particular denotation, this caused Ycheck to fail.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/transform')
-rw-r--r--compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala20
1 files changed, 14 insertions, 6 deletions
diff --git a/compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala b/compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala
index e67b3f114..d955628e3 100644
--- a/compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala
+++ b/compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala
@@ -32,8 +32,21 @@ class ElimRepeated extends MiniPhaseTransform with InfoTransformer with Annotati
def transformInfo(tp: Type, sym: Symbol)(implicit ctx: Context): Type =
elimRepeated(tp)
+
+ override def transform(ref: SingleDenotation)(implicit ctx: Context): SingleDenotation =
+ super.transform(ref) match {
+ case ref1: SymDenotation if (ref1 ne ref) && overridesJava(ref1.symbol) =>
+ // This method won't override the corresponding Java method at the end of this phase,
+ // only the bridge added by `addVarArgsBridge` will.
+ ref1.copySymDenotation(initFlags = ref1.flags &~ Override)
+ case ref1 =>
+ ref1
+ }
+
override def mayChange(sym: Symbol)(implicit ctx: Context): Boolean = sym is Method
+ private def overridesJava(sym: Symbol)(implicit ctx: Context) = sym.allOverriddenSymbols.exists(_ is JavaDefined)
+
private def elimRepeated(tp: Type)(implicit ctx: Context): Type = tp.stripTypeVar match {
case tp @ MethodType(paramNames, paramTypes) =>
val resultType1 = elimRepeated(tp.resultType)
@@ -93,8 +106,7 @@ class ElimRepeated extends MiniPhaseTransform with InfoTransformer with Annotati
*/
override def transformDefDef(tree: DefDef)(implicit ctx: Context, info: TransformerInfo): Tree = {
assert(ctx.phase == thisTransformer)
- def overridesJava = tree.symbol.allOverriddenSymbols.exists(_ is JavaDefined)
- if (tree.symbol.info.isVarArgsMethod && overridesJava)
+ if (tree.symbol.info.isVarArgsMethod && overridesJava(tree.symbol))
addVarArgsBridge(tree)
else
tree
@@ -121,10 +133,6 @@ class ElimRepeated extends MiniPhaseTransform with InfoTransformer with Annotati
.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)
}