diff options
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/t3670.check | 5 | ||||
-rw-r--r-- | test/files/run/t3670.scala | 31 | ||||
-rw-r--r-- | test/files/run/t3877.check | 104 | ||||
-rw-r--r-- | test/files/run/t3877.scala | 81 |
4 files changed, 221 insertions, 0 deletions
diff --git a/test/files/run/t3670.check b/test/files/run/t3670.check new file mode 100644 index 0000000000..bc49bb6437 --- /dev/null +++ b/test/files/run/t3670.check @@ -0,0 +1,5 @@ +a +b +1 +2 +42 diff --git a/test/files/run/t3670.scala b/test/files/run/t3670.scala new file mode 100644 index 0000000000..a37c3a242c --- /dev/null +++ b/test/files/run/t3670.scala @@ -0,0 +1,31 @@ +class C { + val things = List("abcs") + + if (things.length < 30) { + lazy val a = "a" + println(a) + } + if (things.length < 30) { + lazy val b = "b" + println(b) + } +} + +class M extends Application { + def foo { + lazy val a = { + lazy val b = 1 + lazy val c = 2 + println(b) + println(c) + } + a + lazy val d = 42 + println(d) + } +} + +object Test extends Application { + new C() + new M().foo +}
\ No newline at end of file diff --git a/test/files/run/t3877.check b/test/files/run/t3877.check new file mode 100644 index 0000000000..72aa5577f6 --- /dev/null +++ b/test/files/run/t3877.check @@ -0,0 +1,104 @@ +test1: 3 +test1: 4 +test1: 5 +test1: 6 +test1: 7 +test1: 8 +test1: 9 +test1: 10 +test2: 3 +test2: 4 +test2: 5 +test2: 6 +test2: 7 +test2: 8 +test2: 9 +test2: 10 +test3: 3 +test3: 4 +test3: 5 +test3: 6 +test3: 7 +test3: 8 +test3: 9 +test3: 10 +test4: 3 +test4: 4 +test4: 5 +test4: 6 +test4: 7 +test4: 8 +test4: 9 +test4: 10 +test5.1: 3 +test5.2: 3 +test5.2: 4 +test5.2: 5 +test5.2: 6 +test5.2: 7 +test5.2: 8 +test5.2: 9 +test5.2: 10 +test5.1: 4 +test5.2: 3 +test5.2: 4 +test5.2: 5 +test5.2: 6 +test5.2: 7 +test5.2: 8 +test5.2: 9 +test5.2: 10 +test5.1: 5 +test5.2: 3 +test5.2: 4 +test5.2: 5 +test5.2: 6 +test5.2: 7 +test5.2: 8 +test5.2: 9 +test5.2: 10 +test5.1: 6 +test5.2: 3 +test5.2: 4 +test5.2: 5 +test5.2: 6 +test5.2: 7 +test5.2: 8 +test5.2: 9 +test5.2: 10 +test5.1: 7 +test5.2: 3 +test5.2: 4 +test5.2: 5 +test5.2: 6 +test5.2: 7 +test5.2: 8 +test5.2: 9 +test5.2: 10 +test5.1: 8 +test5.2: 3 +test5.2: 4 +test5.2: 5 +test5.2: 6 +test5.2: 7 +test5.2: 8 +test5.2: 9 +test5.2: 10 +test5.1: 9 +test5.2: 3 +test5.2: 4 +test5.2: 5 +test5.2: 6 +test5.2: 7 +test5.2: 8 +test5.2: 9 +test5.2: 10 +test5.1: 10 +test5.2: 3 +test5.2: 4 +test5.2: 5 +test5.2: 6 +test5.2: 7 +test5.2: 8 +test5.2: 9 +test5.2: 10 diff --git a/test/files/run/t3877.scala b/test/files/run/t3877.scala new file mode 100644 index 0000000000..5710e982a0 --- /dev/null +++ b/test/files/run/t3877.scala @@ -0,0 +1,81 @@ +object Test { + val LIMIT = 10 + + def test1 { + var d = 2 + var i = 0 // avoid infinite loops + while (d < LIMIT && i < LIMIT) { + lazy val b = d + 1 + d = b + i += 1 + println("test1: " + d) + } + } + + def test2 { + var d = 2 + var i = 0 + while (true) { + lazy val b = d + 1 + d = b + i += 1 + println("test2: " + d) + + if (d >= LIMIT || i >= LIMIT) + return + } + } + + def test3 { + var d = 2 + var i = 0 + do { + lazy val b = d + 1 + d = b + i += 1 + println("test3: " + d) + } while (d < LIMIT && i < LIMIT) + } + + def test4 { + var d = 2 + var i = 0 + do { + lazy val b = d + 1 + d = b + i += 1 + println("test4: " + d) + if (d >= LIMIT || i >= LIMIT) + return + } while (true) + } + + def test5 { + var d = 2 + var i = 0 + while (d < LIMIT && i < LIMIT) { + lazy val b = d + 1 + d = b + i += 1 + println("test5.1: " + d) + + var e = 2 + var j = 0 + while (e < LIMIT && j < LIMIT) { + lazy val f = e + 1 + e = f + j += 1 + println("test5.2: " + e) + } + } + } + + + def main(args: Array[String]) { + test1 + test2 + test3 + test4 + test5 + } +} |