Skip to content

Commit f036195

Browse files
authored
SimplePattern errors should now be recovered as wildcard instead of unimplemented expr (#21438)
We should not emit more errors that came from our error recovery term trees. Previously, we've recovered those situations with unimplemented expression term added in #19103 and before that it was just a `null`
1 parent 1604e77 commit f036195

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

Diff for: compiler/src/dotty/tools/dotc/parsing/Parsers.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -3198,7 +3198,7 @@ object Parsers {
31983198
else {
31993199
val start = in.lastOffset
32003200
syntaxErrorOrIncomplete(IllegalStartOfSimplePattern(), expectedOffset)
3201-
errorTermTree(start)
3201+
atSpan(Span(start, in.offset)) { Ident(nme.WILDCARD) }
32023202
}
32033203
}
32043204

Diff for: tests/neg/i5004.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ object i0 {
22
1 match {
33
def this(): Int // error
44
def this()
5-
} // error
5+
}
66
}

Diff for: tests/neg/parser-stability-1.scala

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
object x0 {
22
x1 match // error
33
def this // error
4-
// error

0 commit comments

Comments
 (0)