diff options
author | Paul Phillips <paulp@improving.org> | 2012-05-03 23:41:10 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-05-04 01:22:23 -0700 |
commit | aad6deae7204a7fc95b59ede61b188bb62f51188 (patch) | |
tree | 4c034353840a59ee001c8e330c23126a0c50fb13 /test/files/run/t5612.scala | |
parent | f146d5826fc335ee1ca9c285d69086a7475cb71e (diff) | |
download | scala-aad6deae7204a7fc95b59ede61b188bb62f51188.tar.gz scala-aad6deae7204a7fc95b59ede61b188bb62f51188.tar.bz2 scala-aad6deae7204a7fc95b59ede61b188bb62f51188.zip |
Fix for broken non-local returns.
Don't change the owner of a return if the new owner is nested
inside the old owner. Closes SI-5612.
Diffstat (limited to 'test/files/run/t5612.scala')
-rw-r--r-- | test/files/run/t5612.scala | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/files/run/t5612.scala b/test/files/run/t5612.scala new file mode 100644 index 0000000000..48b3093548 --- /dev/null +++ b/test/files/run/t5612.scala @@ -0,0 +1,28 @@ +object L extends Enumeration { + val One, Two, Three = Value +} + +class Foo { + def foo(xs: List[L.Value]) { + import scala.util.control.Breaks.{break, breakable} + println("START for " + xs) + breakable { + for (x <- xs) { + x match { + case L.One => println("ONE"); return + case L.Two => println("TWO") + case L.Three => println("THREE"); break + } + } + } + println("FINISH") + } +} + +object Test { + def main(args: Array[String]) { + val f = new Foo() + val l = List(L.Two, L.Two, L.One, L.Three) + f.foo(l) + } +} |