Permalink
Browse files

Closes SI-5796.

  • Loading branch information...
hubertp committed May 14, 2012
1 parent 97046e6 commit efdac16e04bc1cd64113ad22fb4aa8f5191a316f
Showing with 11 additions and 2 deletions.
  1. +3 −2 src/compiler/scala/tools/nsc/transform/LazyVals.scala
  2. +8 −0 test/files/pos/t5796.scala
@@ -75,7 +75,8 @@ abstract class LazyVals extends Transform with TypingTransformers with ast.TreeD
val stats1 = stats.flatMap(_ match {
case Block(List(d1@DefDef(_, n1, _, _, _, _)), d2@DefDef(_, n2, _, _, _, _)) if (nme.newLazyValSlowComputeName(n2) == n1) =>
List(d1, d2)
case stat => List(stat)
case stat =>
List(stat)
})
treeCopy.Block(block1, stats1, expr)
@@ -138,7 +139,7 @@ abstract class LazyVals extends Transform with TypingTransformers with ast.TreeD
case ValDef(_, _, _, _) if !sym.owner.isModule && !sym.owner.isClass =>
deriveValDef(tree) { rhs0 =>
val rhs = super.transform(rhs0)
val rhs = transform(rhs0)
if (LocalLazyValFinder.find(rhs)) typed(addBitmapDefs(sym, rhs)) else rhs
}
@@ -0,0 +1,8 @@
object Bug {
def foo() {
val v = {
lazy val s = 0
s
}
}
}

0 comments on commit efdac16

Please sign in to comment.