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

cmd/compile/internal/types2: bug in type inference #45548

Closed
griesemer opened this issue Apr 13, 2021 · 4 comments
Closed

cmd/compile/internal/types2: bug in type inference #45548

griesemer opened this issue Apr 13, 2021 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@griesemer
Copy link
Contributor

For the following program

package p

func f[F interface{type *Q}, G interface{type *R}, Q, R any](q Q, r R) {}

func _() {
	f[*float64](1, 2)
}

type inference infers for the call of f:

### inferred targs = [*float64 *R₄ float64 int]

instead of

### inferred targs = [*float64 *int float64 int]

leading to an errror:

/Users/gri/tmp/test.go2:6:13: no error expected: "*R does not satisfy interface{type *R} (*R not found in *int)"
@griesemer griesemer added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 13, 2021
@griesemer griesemer added this to the Go1.17 milestone Apr 13, 2021
@griesemer griesemer self-assigned this Apr 13, 2021
@griesemer
Copy link
Contributor Author

cc: @findleyr

@ianlancetaylor
Copy link
Contributor

Should types2 issues that only occur with generics be milestone Go1.17? It doesn't seem like they need to be fixed for the 1.17 release. Go1.18 might be a better milestone.

@griesemer
Copy link
Contributor Author

I marked some of them that I hope to have fixed for 1.17 as such. This one I am actively working on and should be fixed by 1.17.

@gopherbot
Copy link

Change https://golang.org/cl/311651 mentions this issue: cmd/compile/internal/types2: fix type inference

@golang golang locked and limited conversation to collaborators Apr 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants