summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala2
-rw-r--r--test/files/run/lazy-locals.check1
-rw-r--r--test/files/run/lazy-locals.scala6
4 files changed, 9 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala
index 94c19baa34..10feac1b4a 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala
@@ -138,7 +138,7 @@ abstract class TreeBrowsers {
var splitPane: JSplitPane = _
var treeModel: TreeModel = _
- val textArea: JTextArea = new JTextArea(20, 50)
+ val textArea: JTextArea = new JTextArea(20, 150)
val infoPanel = new TextInfoPanel()
/** Create a frame that displays the AST.
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index bb552de8b9..2548375e93 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -628,7 +628,7 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
applyUnary(tree)
case TypeApply(_, _) =>
applyUnary(tree)
- case Return(expr) if (tree.symbol != currentOwner.enclMethod) =>
+ case Return(expr) if (tree.symbol != currentOwner.enclMethod || currentOwner.hasFlag(LAZY)) =>
if (settings.debug.value) log("non local return in "+tree.symbol+" from "+currentOwner.enclMethod)
atPos(tree.pos)(nonLocalReturnThrow(expr, tree.symbol))
case TypeTree() =>
diff --git a/test/files/run/lazy-locals.check b/test/files/run/lazy-locals.check
index 08d99562c2..63beca0717 100644
--- a/test/files/run/lazy-locals.check
+++ b/test/files/run/lazy-locals.check
@@ -81,3 +81,4 @@ forced lazy val t at n = 5
1764
First 5 elements of ones: List(1, 1, 1, 1, 1)
I am initialized when the constructor is run
+false
diff --git a/test/files/run/lazy-locals.scala b/test/files/run/lazy-locals.scala
index 324f7c00e4..000f4d2faf 100644
--- a/test/files/run/lazy-locals.scala
+++ b/test/files/run/lazy-locals.scala
@@ -133,6 +133,11 @@ object Test extends Application {
()
}
+ def testReturnInLazyVal: Boolean = {
+ lazy val go = { return false }
+ go
+ }
+
{
lazy val inCtor = "I am initialized when the constructor is run"
inCtor
@@ -155,4 +160,5 @@ object Test extends Application {
println(testLazyRecMany(5))
testRecVal
new CtorBlock
+ println(testReturnInLazyVal)
}