Skip to content

Commit d8ff1cd

Browse files
committed
Test partial func within if body
1 parent ec82b80 commit d8ff1cd

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

tests/shared/src/test/scala/scala/meta/tests/parsers/dotty/SignificantIndentationSuite.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2072,6 +2072,20 @@ class SignificantIndentationSuite extends BaseDottySuite {
20722072
))
20732073
}
20742074

2075+
test("`if` body is a partial function") {
2076+
val code =
2077+
"""| if foo then
2078+
| case msg1: Int => msg1 + 1
2079+
| else
2080+
| case msg2: Int => msg2 + 2
2081+
|""".stripMargin
2082+
val error =
2083+
"""|<input>:2: error: `outdent` expected but `case` found
2084+
| case msg1: Int => msg1 + 1
2085+
| ^""".stripMargin
2086+
runTestError[Stat](code, error)
2087+
}
2088+
20752089
test("def body is non-partial function") {
20762090
val code =
20772091
"""|object a:

0 commit comments

Comments
 (0)