From 6111acc8e6bc96f5ca0fa58adf4a0226fff3dd28 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Tue, 28 Nov 2023 16:07:01 -0500 Subject: [PATCH] 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 Reviewed-by: Robert Findley Auto-Submit: Alan Donovan --- src/go/types/check.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) { -- 2.48.1