diff options
author | Paul Phillips <paulp@improving.org> | 2012-08-10 07:28:56 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-08-10 12:30:54 -0700 |
commit | 0aa77ffa7cf2a95d9d84d4bc5e635163a84ca931 (patch) | |
tree | 831815116e90f6d87dd42b3d379449c1db2aad80 /test/files/neg/nonlocal-warning.scala | |
parent | fbbbb2294680c0f57506f885971b148cae53c92d (diff) | |
download | scala-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.scala | 7 |
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 + } +} |