summaryrefslogtreecommitdiff
path: root/test/files/neg/nonlocal-warning.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-08-10 07:28:56 -0700
committerPaul Phillips <paulp@improving.org>2012-08-10 12:30:54 -0700
commit0aa77ffa7cf2a95d9d84d4bc5e635163a84ca931 (patch)
tree831815116e90f6d87dd42b3d379449c1db2aad80 /test/files/neg/nonlocal-warning.scala
parentfbbbb2294680c0f57506f885971b148cae53c92d (diff)
downloadscala-0aa77ffa7cf2a95d9d84d4bc5e635163a84ca931.tar.gz
scala-0aa77ffa7cf2a95d9d84d4bc5e635163a84ca931.tar.bz2
scala-0aa77ffa7cf2a95d9d84d4bc5e635163a84ca931.zip
Warn about catching non-local returns.
Almost every time someone is shooting themself in the foot by catching a non-local return, it is apparent from the structure of the AST that they are doing so. Warn them.
Diffstat (limited to 'test/files/neg/nonlocal-warning.scala')
-rw-r--r--test/files/neg/nonlocal-warning.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/files/neg/nonlocal-warning.scala b/test/files/neg/nonlocal-warning.scala
new file mode 100644
index 0000000000..cc98bd631a
--- /dev/null
+++ b/test/files/neg/nonlocal-warning.scala
@@ -0,0 +1,7 @@
+class Foo {
+ def foo(l: List[Int]): Int = {
+ try l foreach { _ => return 5 }
+ catch { case x => 11 }
+ 22
+ }
+}