mirror of
https://github.com/golang/go.git
synced 2026-01-29 15:12:08 +03:00
This change causes the "x is not a type" diagnostic to describe x's actual kind, helping to reveal when shadowing is at work. (The kind description could improve other errors too.) Fixes #76877 Change-Id: Ia3484998bb384ff570c20b6792cf8461c60aa38c Reviewed-on: https://go-review.googlesource.com/c/go/+/731180 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Robert Griesemer <gri@google.com>
17 lines
334 B
Go
17 lines
334 B
Go
// errorcheck
|
|
|
|
// Copyright 2012 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.
|
|
|
|
package main
|
|
|
|
type bar struct {
|
|
x int
|
|
}
|
|
|
|
func main() {
|
|
var foo bar
|
|
_ = &foo{} // ERROR "is not a type|expected .;."
|
|
} // GCCGO_ERROR "expected declaration"
|