summaryrefslogtreecommitdiff
path: root/test/files/neg/nonlocal-warning.check
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.check
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.check')
-rw-r--r--test/files/neg/nonlocal-warning.check9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/files/neg/nonlocal-warning.check b/test/files/neg/nonlocal-warning.check
new file mode 100644
index 0000000000..efb3efaaa2
--- /dev/null
+++ b/test/files/neg/nonlocal-warning.check
@@ -0,0 +1,9 @@
+nonlocal-warning.scala:4: warning: This catches all Throwables. If this is really intended, use `case x: Throwable` to clear this warning.
+ catch { case x => 11 }
+ ^
+nonlocal-warning.scala:2: warning: catch block may intercept non-local return from method foo
+ def foo(l: List[Int]): Int = {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
+one error found