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: inference fails where it should succeed when considering interface methods #60564

Closed
griesemer opened this issue Jun 1, 2023 · 1 comment
Assignees
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@griesemer
Copy link
Contributor

This code produces an error but we should be able to infer T in this case.

package p

type I[T any] interface {
	m(T)
}

func f5[T any](I[T]) {}

func _() {
	var x interface {
		m(int)
		n()
	}
	f5(x /* ERROR "type interface{m(int); n()} of x does not match inferred type I[int] for I[T]" */)
	f5[int](x) // ok
}

Not a release blocker as it doesn't work either in Go 1.20. But should fix if not too hard.

cc: @findleyr

@griesemer griesemer added the NeedsFix The path to resolution is known, but the work has not been done. label Jun 1, 2023
@griesemer griesemer added this to the Go1.21 milestone Jun 1, 2023
@griesemer griesemer self-assigned this Jun 1, 2023
@griesemer griesemer changed the title go/types, types2: go/types, types2: inference fails where it should succeed when considering interface methods Jun 1, 2023
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/500195 mentions this issue: go/types, types2: handle all type parameters before big unify switch

@golang golang locked and limited conversation to collaborators Jun 5, 2024
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.
Projects
None yet
Development

No branches or pull requests

2 participants