summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala3
-rw-r--r--test/files/run/t2333.scala16
2 files changed, 18 insertions, 1 deletions
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