mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Parse] Skip ahead if seeing any error while parsing list.
If we found any error in a list, in most cases, we cannot expect that the following tokens could construct a valid element. Skip them, instead of trying to parse them as the next element. This significally reduces bogus diagnostics. Bailout if seeing tok::eof or token that can never start a element, after parsing an element. This silences superfluous "expected ',' separator" error, or misleading expected declaration error. What we should emit is "expected ')' in expression list, or "expected '}' in struct".
This commit is contained in:
@@ -308,7 +308,7 @@ case (_?)?: break
|
||||
|
||||
// <rdar://problem/20365753> Bogus diagnostic "refutable pattern match can fail"
|
||||
let (responseObject: Int?) = op1
|
||||
// expected-error @-1 2 {{expected ',' separator}} {{25-25=,}} {{25-25=,}}
|
||||
// expected-error @-1 {{expected ',' separator}} {{25-25=,}}
|
||||
// expected-error @-2 {{expected pattern}}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user