Skip to content

Commit 735020f

Browse files
authored
Merge pull request #8149 from dotty-staging/issue/8096/add-regression
fix #8096: add regression
2 parents a771185 + 7174606 commit 735020f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/neg/i8096.scala

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
def k: Unit =
2+
val s: String = try
3+
"WUT"
4+
catch case _ => println("caught something") // error: Type Mismatch Error
5+
6+
"OK" // warning: A pure expression does nothing in statement position
7+
8+
def block: String = try "" catch case _ => () // error: Type Mismatch Error
9+
"" // error: Expected a toplevel definition
10+
11+
def i: Int = try 0 catch
12+
case _ => () // error: Type Mismatch Error
13+
1 // error: Expected a toplevel definition

0 commit comments

Comments
 (0)