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
Assignees
Milestone

Comments

@griesemer
Copy link
Contributor

@griesemer griesemer commented Apr 13, 2021

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 this to the Go1.17 milestone Apr 13, 2021
@griesemer griesemer self-assigned this Apr 13, 2021
@griesemer
Copy link
Contributor Author

@griesemer griesemer commented Apr 13, 2021

cc: @findleyr

Loading

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Apr 19, 2021

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.

Loading

@griesemer
Copy link
Contributor Author

@griesemer griesemer commented Apr 19, 2021

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.

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Apr 20, 2021

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

Loading

@gopherbot gopherbot closed this in 190cb93 Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants