aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlan Donovan <adonovan@google.com>2023-11-28 16:07:01 -0500
committerGopher Robot <gobot@golang.org>2023-11-28 22:55:47 +0000
commit6111acc8e6bc96f5ca0fa58adf4a0226fff3dd28 (patch)
treed03218dd7daf2f45f077aea12a292bc4b55f5f36 /src
parentaae7734658e5f302c0e3a10f6c5c596fd384dbd7 (diff)
downloadgo-6111acc8e6bc96f5ca0fa58adf4a0226fff3dd28.tar.xz
go/types: include AST in instantiatedIdent panic message
Updates golang/go#63933 Change-Id: I3ff71e92d124c850eb8b4d136e163bf5786897a2 Reviewed-on: https://go-review.googlesource.com/c/go/+/545615 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Alan Donovan <adonovan@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/go/types/check.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/go/types/check.go b/src/go/types/check.go
index 4a5f0731df..85fd0744d2 100644
--- a/src/go/types/check.go
+++ b/src/go/types/check.go
@@ -14,6 +14,7 @@ import (
"go/token"
"internal/godebug"
. "internal/types/errors"
+ "strings"
)
// nopos indicates an unknown position
@@ -618,7 +619,12 @@ func instantiatedIdent(expr ast.Expr) *ast.Ident {
case *ast.SelectorExpr:
return x.Sel
}
- panic("instantiated ident not found")
+
+ // extra debugging of #63933
+ var buf strings.Builder
+ buf.WriteString("instantiated ident not found; please report: ")
+ ast.Fprint(&buf, token.NewFileSet(), expr, ast.NotNilFilter)
+ panic(buf.String())
}
func (check *Checker) recordDef(id *ast.Ident, obj Object) {