mirror of
https://github.com/golang/go
synced 2024-11-24 04:00:13 -07:00
70da2d0a2a
Following an empty import, a declaration involving a ? symbol generates an internal compiler error when the name of the symbol (in newname function). package a import"" var? go.go:2: import path is empty go.go:3: internal compiler error: newname nil Make sure dclname is not called when the symbol is nil. The error message is now: go.go:2: import path is empty go.go:3: invalid declaration go.go:4: syntax error: unexpected EOF This CL was initially meant to be applied to the old parser, and has been updated to apply to the new parser. Fixes #11610 Change-Id: I75e07622fb3af1d104e3a38c89d9e128e3b94522 Reviewed-on: https://go-review.googlesource.com/15268 Reviewed-by: Russ Cox <rsc@golang.org>
18 lines
415 B
Go
18 lines
415 B
Go
// errorcheck
|
|
|
|
// Copyright 2015 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// Test an internal compiler error on ? symbol in declaration
|
|
// following an empty import.
|
|
|
|
package a
|
|
import"" // ERROR "import path is empty"
|
|
var? // ERROR "invalid declaration"
|
|
|
|
var x int // ERROR "unexpected var"
|
|
|
|
func main() {
|
|
}
|