]> Cypherpunks repositories - gostls13.git/commitdiff
go/types: document that Defs[id] may be missing in ill-typed code
authorAlan Donovan <adonovan@google.com>
Tue, 8 Apr 2025 18:12:00 +0000 (14:12 -0400)
committerGopher Robot <gobot@golang.org>
Tue, 8 Apr 2025 20:26:21 +0000 (13:26 -0700)
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>
src/go/types/api.go

index beb2258c8b6f4793e3be21f34eee797eaac392dd..f60c2ff7ee42effccd20a94fee97f5a9340f8503 100644 (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