go/types: document that Defs[id] may be missing in ill-typed code

Updates #70968

Change-Id: Id0a4acd6bad917ba8a5c439625bca14469b6eb7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/663895
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
Alan Donovan 2025-04-08 14:12:00 -04:00 committed by Gopher Robot
parent 559b5d814f
commit 8433412b74

View File

@ -254,6 +254,9 @@ type Info struct {
//
// For an embedded field, Defs returns the field *Var it defines.
//
// In ill-typed code, such as a duplicate declaration of the
// same name, Defs may lack an entry for a declaring identifier.
//
// Invariant: Defs[id] == nil || Defs[id].Pos() == id.Pos()
Defs map[*ast.Ident]Object