From b7efe9089062fd3908c07f19ee16a4ec39afdbb8 Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Tue, 12 Oct 2010 12:31:35 +0000 Subject: Closes #2333. Review by dragos --- src/compiler/scala/tools/nsc/transform/UnCurry.scala | 3 ++- test/files/run/t2333.scala | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 test/files/run/t2333.scala diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index 4901ca4d70..6532aaaa2d 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -596,7 +596,8 @@ abstract class UnCurry extends InfoTransform with TypingTransformers { case Assign(Select(_, _), _) => withNeedLift(true) { super.transform(tree) } - case Assign(lhs, _) if lhs.symbol.owner != currentMethod => + + case Assign(lhs, _) if lhs.symbol.owner != currentMethod || lhs.symbol.hasFlag(LAZY | ACCESSOR) => withNeedLift(true) { super.transform(tree) } case Try(block, catches, finalizer) => diff --git a/test/files/run/t2333.scala b/test/files/run/t2333.scala new file mode 100644 index 0000000000..da43386572 --- /dev/null +++ b/test/files/run/t2333.scala @@ -0,0 +1,16 @@ +class A { + def whatever() { + lazy val a = 1 + lazy val b = try { 2 } catch { case _ => 0 } + a + b + + } +} + +object Test { + def main(a: Array[String]) { + val a = new A + a.whatever + } +} \ No newline at end of file -- cgit v1.2.3