[go] go/types: better diagnostic for type shadowing

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Jan 15, 2026, 6:10:32 PM (3 days ago) Jan 15
to Alan Donovan, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Robert Griesemer, Go LUCI, Mark Freeman, Robert Griesemer, golang-co...@googlegroups.com

Gopher Robot submitted the change

Change information

Commit message:
go/types,cmd/compile/internal/types2: better diagnostic for type shadowing

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-by: Robert Griesemer <g...@google.com>
Auto-Submit: Alan Donovan <adon...@google.com>
Auto-Submit: Robert Griesemer <g...@google.com>
Files:
  • M src/cmd/compile/internal/types2/object.go
  • M src/cmd/compile/internal/types2/typexpr.go
  • M src/go/types/object.go
  • M src/go/types/typexpr.go
  • M src/internal/types/testdata/check/cycles5.go
  • M src/internal/types/testdata/check/cycles5a.go
  • M src/internal/types/testdata/check/decls1.go
  • M src/internal/types/testdata/check/issues0.go
  • M src/internal/types/testdata/check/issues1.go
  • M src/internal/types/testdata/fixedbugs/issue39634.go
  • M src/internal/types/testdata/fixedbugs/issue65344.go
  • M test/fixedbugs/issue4610.go
Change size: M
Delta: 12 files changed, 117 insertions(+), 11 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Robert Griesemer
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ia3484998bb384ff570c20b6792cf8461c60aa38c
Gerrit-Change-Number: 731180
Gerrit-PatchSet: 9
Gerrit-Owner: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Mark Freeman <markf...@google.com>
Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
Gerrit-Reviewer: Robert Griesemer <g...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages