-
Notifications
You must be signed in to change notification settings - Fork 17.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/tools/go/types/objectpath: stack overflow trying to find inaccessible object in package with recursive interface #68046
Comments
Translating these line numbers into source, this is the recursion:
So it looks an interface method whose result is (or embeds) the same interface, e.g. [Update: my first draft was wrong because the lines had moved since gopls/v0.15.3] |
I can reproduce the crash by fruitlessly trying to search for an inaccessible dummy object (a types.Var) within a package that contains this recursive interface type: type Issue68046 interface { f() interface{Issue68046} } Here's the diff: diff --git a/go/types/objectpath/objectpath_test.go b/go/types/objectpath/objectpath_test.go
index 238ebb20c8..d20ff4c7ae 100644
--- a/go/types/objectpath/objectpath_test.go
+++ b/go/types/objectpath/objectpath_test.go
@@ -60,6 +60,8 @@ type Int int
type T struct{x, y int}
+type Issue68046 interface { f() interface{Issue68046} }
+
`},
}
paths := []pathTest{
@@ -131,6 +133,9 @@ type T struct{x, y int}
}
}
+ dummy := types.NewVar(token.NoPos, prog.Imported["a"].Pkg, "dummy", types.Typ[types.String])
+ objectpath.For(dummy)
+
// bad objects
bInfo := prog.Imported["b"]
for _, test := range []struct { and here's the crash:
|
This stack
wgsP2A
was reported by telemetry:Issue created by golang.org/x/tools/gopls/internal/telemetry/cmd/stacks.
The text was updated successfully, but these errors were encountered: