From: Alan Donovan Date: Tue, 28 Nov 2023 21:07:01 +0000 (-0500) Subject: go/types: include AST in instantiatedIdent panic message X-Git-Tag: go1.22rc1~141 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=6111acc8e6bc96f5ca0fa58adf4a0226fff3dd28;p=gostls13.git 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 --- 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) {