| 1 |
|
| 2 |
This test exercises diagnostics produced for syntax errors. |
| 3 |
|
| 4 |
Because parser error recovery can be quite lossy, diagnostics |
| 5 |
for type errors are suppressed in files with syntax errors; |
| 6 |
see issue #59888. But diagnostics are reported for type errors |
| 7 |
in well-formed files of the same package. |
| 8 |
|
| 9 |
-- go.mod -- |
| 10 |
module example.com |
| 11 |
go 1.12 |
| 12 |
|
| 13 |
-- bad.go -- |
| 14 |
package p |
| 15 |
|
| 16 |
func f() { |
| 17 |
append("") // no diagnostic for type error in file containing syntax error |
| 18 |
} |
| 19 |
|
| 20 |
func .() {} //@diag(re"func ().", re"expected 'IDENT', found '.'") |
| 21 |
|
| 22 |
-- good.go -- |
| 23 |
package p |
| 24 |
|
| 25 |
func g() { |
| 26 |
append("") //@diag(re`""`, re"a slice") |
| 27 |
} |