Skip to content

Commit 74cfecf

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 417c9bc commit 74cfecf

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -3165,7 +3165,7 @@ object Parsers {
31653165
else {
31663166
val start = in.lastOffset
31673167
syntaxErrorOrIncomplete(IllegalStartOfSimplePattern(), expectedOffset)
3168-
errorTermTree(start)
3168+
atSpan(Span(start, in.offset)) { Ident(nme.WILDCARD) }
31693169
}
31703170
}
31713171

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
}

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)