From 717460681cd9485a5cd981e3cca300f605bdee95 Mon Sep 17 00:00:00 2001 From: bishabosha Date: Thu, 30 Jan 2020 21:41:22 +0100 Subject: [PATCH] fix #8096: add regression --- tests/neg/i8096.scala | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tests/neg/i8096.scala diff --git a/tests/neg/i8096.scala b/tests/neg/i8096.scala new file mode 100644 index 000000000000..7eb61bafb7ad --- /dev/null +++ b/tests/neg/i8096.scala @@ -0,0 +1,13 @@ +def k: Unit = + val s: String = try + "WUT" + catch case _ => println("caught something") // error: Type Mismatch Error + + "OK" // warning: A pure expression does nothing in statement position + +def block: String = try "" catch case _ => () // error: Type Mismatch Error + "" // error: Expected a toplevel definition + +def i: Int = try 0 catch + case _ => () // error: Type Mismatch Error + 1 // error: Expected a toplevel definition