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 11package p 12 13func _() { 14 go func() { // no error here about goroutine 15 send <- // GCCGO_ERROR "undefined name" 16 }() // ERROR "expected expression|expected operand" 17} 18 19func _() { 20 defer func() { // no error here about deferred function 21 1 + // GCCGO_ERROR "value computed is not used" 22 }() // ERROR "expected expression|expected operand" 23} 24 25func _() { 26 _ = (1 +) // ERROR "expected expression|expected operand" 27 _ = a[2 +] // ERROR "expected expression|expected operand|undefined name" 28 _ = []int{1, 2, 3 + } // ERROR "expected expression|expected operand" 29} 30