From 6bf20ee474afa46564899e9f57065ad1f22fabed Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Thu, 8 Sep 2016 15:23:22 +1000 Subject: Compatibility with Scala 2.12.0-RC1 - method local lazy vals are now encoded as a single ValDef rather than a ValDef + DefDef pair. We need to treat ValDef-s with the LAZY flag in the same way as we used to treat the DefDef. - Rename one of the symbols `ANF,anf` in the same scope to avoid generating anonymous class names that differ only in case. The compiler warned about this one. - When patching the LabelDefs to have a `Unit` result type, propagate this other LabelDefs conclude with a jump to that label. Not sure why, but without this we now hit an error in the backend about the nonsensical attempt to emit a coercion from void to int. - Use crossScalaVersions in the build and update the Scala versions tested in CI. --- src/main/scala/scala/async/internal/Lifter.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main/scala/scala/async/internal/Lifter.scala') diff --git a/src/main/scala/scala/async/internal/Lifter.scala b/src/main/scala/scala/async/internal/Lifter.scala index 9481f69..3afe6d6 100644 --- a/src/main/scala/scala/async/internal/Lifter.scala +++ b/src/main/scala/scala/async/internal/Lifter.scala @@ -92,7 +92,7 @@ trait Lifter { // Only mark transitive references of defs, modules and classes. The RHS of lifted vals/vars // stays in its original location, so things that it refers to need not be lifted. - if (!(sym.isTerm && (sym.asTerm.isVal || sym.asTerm.isVar))) + if (!(sym.isTerm && !sym.asTerm.isLazy && (sym.asTerm.isVal || sym.asTerm.isVar))) defSymToReferenced(sym).foreach(sym2 => markForLift(sym2)) } } @@ -117,7 +117,8 @@ trait Lifter { sym.setFlag(MUTABLE | STABLE | PRIVATE | LOCAL) sym.setName(name.fresh(sym.name.toTermName)) sym.setInfo(deconst(sym.info)) - treeCopy.ValDef(vd, Modifiers(sym.flags), sym.name, TypeTree(tpe(sym)).setPos(t.pos), EmptyTree) + val rhs1 = if (sym.asTerm.isLazy) rhs else EmptyTree + treeCopy.ValDef(vd, Modifiers(sym.flags), sym.name, TypeTree(tpe(sym)).setPos(t.pos), rhs1) case dd@DefDef(_, _, tparams, vparamss, tpt, rhs) => sym.setName(this.name.fresh(sym.name.toTermName)) sym.setFlag(PRIVATE | LOCAL) -- cgit v1.2.3