Skip to content
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

go/types, types2: duplicate type instances are not recorded in Info.Instances #51494

Closed
findleyr opened this issue Mar 4, 2022 · 2 comments
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@findleyr
Copy link
Contributor

findleyr commented Mar 4, 2022

In the following source, we only record one instance in types.Info.Instances for T[int]: the other is not recorded due to a cache hit:

type r1[P any, Q *P] struct{}

func (_ r1[P, Q]) m(P) {
}

type T[A any, B *A] struct {
	F r1[int]
}

func _(t T[int]) {
	t.F.m(0)
}

var x = T[int]{}.F

This is inconsistent with how functions are treated, and not what is documented.

CC @griesemer @mdempsky @timothy-king

@findleyr findleyr changed the title go/types: duplicate instances are not recorded in Info.Instancesj:w go/types: duplicate instances are not recorded in Info.Instances Mar 4, 2022
@findleyr findleyr added this to the Go1.18 milestone Mar 4, 2022
@findleyr findleyr self-assigned this Mar 4, 2022
@findleyr findleyr changed the title go/types: duplicate instances are not recorded in Info.Instances go/types, types2: duplicate instances are not recorded in Info.Instances Mar 4, 2022
@findleyr findleyr changed the title go/types, types2: duplicate instances are not recorded in Info.Instances go/types, types2: duplicate type instances are not recorded in Info.Instances Mar 4, 2022
@gopherbot
Copy link

Change https://go.dev/cl/390041 mentions this issue: go/types, types2: record all type instances, even duplicates

@dmitshur dmitshur added the NeedsFix The path to resolution is known, but the work has not been done. label Mar 7, 2022
@gopherbot
Copy link

Change https://go.dev/cl/390574 mentions this issue: [release-branch.go1.18] go/types, types2: record all type instances, even duplicates

gopherbot pushed a commit that referenced this issue Mar 8, 2022
…even duplicates

Due to instance de-duplication, we were failing to record some type
instances in types.Info.Instances. Fix this by moving the instance
recording out of the resolver.

Fixes #51494

Change-Id: Iddd8989307d95886eedb321efa4ab98cd2b3573a
Reviewed-on: https://go-review.googlesource.com/c/go/+/390041
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 43b09c0)
Reviewed-on: https://go-review.googlesource.com/c/go/+/390574
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
@golang golang locked and limited conversation to collaborators Jun 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

3 participants