Skip to content

go/types: Info.Instances is underpopulated #79285

Description

@adonovan

Examining this program in the go/types playground (golang.org/x/tools/go/types/internal/play), which was recently augmented to show Info.Instances when the selection is an ast.Ident, the only identifier that has an entry in that map is the reference to Method (it has TypeArgs=[int] and Type=func(C[string])). Notably, there is no entry for either of the two references to Func. That seems like a bug.

package main

type C[T any] struct{}

func (C[T]) M()
func (C[T]) Method[U any]() {}

var _ = C[string].M
var _ = C[string].Method[int]

func Func[T any](T) {}

var _ = Func[int]
var _ = Func(1)

@griesemer @mrkfrmn

Metadata

Metadata

Labels

NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions