diff options
author | Szabolcs Berecz <szabolcs.berecz@gmail.com> | 2012-02-19 20:50:22 +0100 |
---|---|---|
committer | Szabolcs Berecz <szabolcs.berecz@gmail.com> | 2012-02-19 21:37:46 +0100 |
commit | 5e52ce9a13f12ef159e25ac80c6be2803ec48950 (patch) | |
tree | b32e8887c21dc3760695eb9e7f1a728f5c95f62c /src | |
parent | cf0ae72aae43dae1e47489fceb684e5448080736 (diff) | |
download | scala-5e52ce9a13f12ef159e25ac80c6be2803ec48950.tar.gz scala-5e52ce9a13f12ef159e25ac80c6be2803ec48950.tar.bz2 scala-5e52ce9a13f12ef159e25ac80c6be2803ec48950.zip |
Fix for SI-5215: scalac crash when @elidable used in trait
The elision is now done by not emitting method calls (it was done by removing the elidable methods).
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/icode/GenICode.scala | 5 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/UnCurry.scala | 16 |
2 files changed, 6 insertions, 15 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index 9e801e3ea8..ca00508dc7 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -876,6 +876,11 @@ abstract class GenICode extends SubComponent { val (newCtx, resKind) = genPrimitiveOp(app, ctx, expectedType) generatedType = resKind newCtx + } else if (sym.elisionLevel.exists (_ < settings.elidebelow.value || settings.noassertions.value)) { + // XXX settings.noassertions.value temporarily retained to avoid + // breakage until a reasonable interface is settled upon. + debuglog("Eliding call from " + tree.symbol.owner + " to " + sym + " based on its elision threshold of " + sym.elisionLevel.get) + ctx } else { // normal method call debuglog("Gen CALL_METHOD with sym: " + sym + " isStaticSymbol: " + sym.isStaticMember); val invokeStyle = diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index c4b70c672c..256c829db0 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -452,19 +452,6 @@ abstract class UnCurry extends InfoTransform } } - /** For removing calls to specially designated methods. - */ - def elideIntoUnit(tree: Tree): Tree = Literal(Constant()) setPos tree.pos setType UnitClass.tpe - def isElidable(tree: Tree) = { - val sym = treeInfo.methPart(tree).symbol - // XXX settings.noassertions.value temporarily retained to avoid - // breakage until a reasonable interface is settled upon. - sym != null && sym.elisionLevel.exists(x => x < settings.elidebelow.value || settings.noassertions.value) && { - log("Eliding call from " + tree.symbol.owner + " to " + sym + " based on its elision threshold of " + sym.elisionLevel.get) - true - } - } - // ------ The tree transformers -------------------------------------------------------- def mainTransform(tree: Tree): Tree = { @@ -502,8 +489,7 @@ abstract class UnCurry extends InfoTransform finally this.inConstructorFlag = saved } - if (isElidable(tree)) elideIntoUnit(tree) - else tree match { + tree match { case dd @ DefDef(mods, name, tparams, vparamss, tpt, rhs) => if (dd.symbol hasAnnotation VarargsClass) saveRepeatedParams(dd) withNeedLift(false) { |