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: infinite recursion in type inference #60556

Closed
griesemer opened this issue Jun 1, 2023 · 1 comment
Closed

go/types, types2: infinite recursion in type inference #60556

griesemer opened this issue Jun 1, 2023 · 1 comment
Assignees
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@griesemer
Copy link
Contributor

package p

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

type S[T any] struct{}

func (S[T]) m(I[T]) {}

func f[T I[E], E any](T) {}

func _() {
	//f[S[int], int](S[int]{}) // ok
	f(S[int]{})
}

causes an infinite recursion. If panicAtUnificationDepthLimit = false, the error is:

testdata/manual.go:15:3: T (type S[int]) does not satisfy I[E] (wrong type for method m)
                        have m(I[int])
                        want m(I[E])
@griesemer griesemer self-assigned this Jun 1, 2023
@griesemer griesemer added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker labels Jun 1, 2023
@griesemer griesemer added this to the Go1.21 milestone Jun 1, 2023
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/499995 mentions this issue: go/types, types2: use assignment rules when unifying costraint method signatures

@golang golang locked and limited conversation to collaborators May 31, 2024
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. release-blocker
Projects
None yet
Development

No branches or pull requests

2 participants