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

proposal: go/types: provide types.Satisfies predicate #57018

griesemer opened this issue Dec 1, 2022 · 1 comment

proposal: go/types: provide types.Satisfies predicate #57018

griesemer opened this issue Dec 1, 2022 · 1 comment


Copy link

With the acceptance of #56548, there's a difference between interface implementation and constraint satisfaction; the latter makes an exception with respect to comparability of types (see #56548).

Since we can't add a flag to types.Implements (breaks backward compatibility), the proposal is to add a new predicate:

// Satisfies reports whether type V satisfies the constraint T.
// The behavior of Satisfies is unspecified if V is Typ[Invalid] or an uninstantiated
// generic type.
func Implements(V Type, T *Interface) bool

cc: @findleyr

@gopherbot gopherbot added this to the Proposal milestone Dec 1, 2022
Copy link
Contributor Author

Closing again as partial duplicate of #56548. I missed that I already made this API addition part of #56548.

@golang golang locked and limited conversation to collaborators Dec 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

2 participants