| 1 |
// errorcheck |
| 2 |
|
| 3 |
// Copyright 2019 The Go Authors. All rights reserved. |
| 4 |
// Use of this source code is governed by a BSD-style |
| 5 |
// license that can be found in the LICENSE file. |
| 6 |
|
| 7 |
// Verify that we don't get spurious follow-on errors |
| 8 |
// after a missing expression. Specifically, the parser |
| 9 |
// shouldn't skip over closing parentheses of any kind. |
| 10 |
|
| 11 |
package p |
| 12 |
|
| 13 |
func _() { |
| 14 |
go func() { // no error here about goroutine |
| 15 |
send <- // GCCGO_ERROR "undefined name" |
| 16 |
}() // ERROR "expecting expression|expected operand" |
| 17 |
} |
| 18 |
|
| 19 |
func _() { |
| 20 |
defer func() { // no error here about deferred function |
| 21 |
1 + |
| 22 |
}() // ERROR "expecting expression|expected operand" |
| 23 |
} |
| 24 |
|
| 25 |
func _() { |
| 26 |
_ = (1 +) // ERROR "expecting expression|expected operand" |
| 27 |
_ = a[2 +] // ERROR "expecting expression|expected operand|undefined name" |
| 28 |
_ = []int{1, 2, 3 + } // ERROR "expecting expression|expected operand" |
| 29 |
} |