Skip to content

Commit 72bce19

Browse files
rochalaWojciechMazur
authored andcommitted
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` [Cherry-picked f036195]
1 parent 2992889 commit 72bce19

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
@@ -3035,7 +3035,7 @@ object Parsers {
30353035
else {
30363036
val start = in.lastOffset
30373037
syntaxErrorOrIncomplete(IllegalStartOfSimplePattern(), expectedOffset)
3038-
errorTermTree(start)
3038+
atSpan(Span(start, in.offset)) { Ident(nme.WILDCARD) }
30393039
}
30403040
}
30413041

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)