summaryrefslogtreecommitdiff
path: root/test/files/neg/catch-all.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-06-22 00:42:39 -0700
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-06-22 00:42:39 -0700
commitcfc0e18dc55b33274c1275c192ade4a8d707d635 (patch)
treeed500a8374b7911fe3b6a7443784764fcd231022 /test/files/neg/catch-all.scala
parentff016002738580a7de11977c91e0061dbcf270ad (diff)
parent7d8527b40a3bd6d93cf155b39ee50577751f3e91 (diff)
downloadscala-cfc0e18dc55b33274c1275c192ade4a8d707d635.tar.gz
scala-cfc0e18dc55b33274c1275c192ade4a8d707d635.tar.bz2
scala-cfc0e18dc55b33274c1275c192ade4a8d707d635.zip
Merge pull request #752 from retronym/topic/warn-catch-all-4
SI-2807 Resurrect and refine the promiscuous catch warning.
Diffstat (limited to 'test/files/neg/catch-all.scala')
-rw-r--r--test/files/neg/catch-all.scala19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/files/neg/catch-all.scala b/test/files/neg/catch-all.scala
new file mode 100644
index 0000000000..35a6d7af91
--- /dev/null
+++ b/test/files/neg/catch-all.scala
@@ -0,0 +1,19 @@
+object CatchAll {
+ try { "warn" } catch { case _ => }
+
+ try { "warn" } catch { case x => }
+
+ try { "warn" } catch { case _: RuntimeException => ; case x => }
+
+ try { "okay" } catch { case _: Throwable => }
+
+ try { "okay" } catch { case _: Exception => }
+
+ try { "okay" } catch { case okay: Throwable => }
+
+ try { "okay" } catch { case okay: Exception => }
+
+ try { "okay" } catch { case _ if "".isEmpty => }
+
+ "okay" match { case _ => "" }
+}