aboutsummaryrefslogtreecommitdiff
path: root/tests/untried/neg/catch-all.scala
diff options
context:
space:
mode:
Diffstat (limited to 'tests/untried/neg/catch-all.scala')
-rw-r--r--tests/untried/neg/catch-all.scala31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/untried/neg/catch-all.scala b/tests/untried/neg/catch-all.scala
new file mode 100644
index 000000000..c05be7704
--- /dev/null
+++ b/tests/untried/neg/catch-all.scala
@@ -0,0 +1,31 @@
+object CatchAll {
+ try { "warn" } catch { case _ => }
+
+ try { "warn" } catch { case x => }
+
+ try { "warn" } catch { case _: RuntimeException => ; case x => }
+
+ val t = T
+
+ try { "okay" } catch { case T => }
+
+ try { "okay" } catch { case `t` => }
+
+ try { "okay" } catch { case x @ T => }
+
+ try { "okay" } catch { case x @ `t` => }
+
+ 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 _ => "" }
+}
+
+object T extends Throwable