]> Cypherpunks repositories - gostls13.git/commit
go/types,cmd/compile/internal/types2: better diagnostic for type shadowing
authorAlan Donovan <adonovan@google.com>
Thu, 18 Dec 2025 17:27:11 +0000 (12:27 -0500)
committerGopher Robot <gobot@golang.org>
Thu, 15 Jan 2026 23:10:27 +0000 (15:10 -0800)
commit532e3203492ebcac67b2f3aa2a52115f49d51997
treeca524691be1918841d9a976c8ccd76db26c3d388
parentbb7c0c717c8b3517210dce8f38cb2c91694af4e2
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-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>
12 files changed:
src/cmd/compile/internal/types2/object.go
src/cmd/compile/internal/types2/typexpr.go
src/go/types/object.go
src/go/types/typexpr.go
src/internal/types/testdata/check/cycles5.go
src/internal/types/testdata/check/cycles5a.go
src/internal/types/testdata/check/decls1.go
src/internal/types/testdata/check/issues0.go
src/internal/types/testdata/check/issues1.go
src/internal/types/testdata/fixedbugs/issue39634.go
src/internal/types/testdata/fixedbugs/issue65344.go
test/fixedbugs/issue4610.go