Fixed #1358.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@16700 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
66b22a511f
commit
a63040620d
|
@ -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.
|
||||
|
|
|
@ -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() =>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue