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

spec: document behavior of type switches containing type parameter cases #51110

griesemer opened this issue Feb 9, 2022 · 2 comments


Copy link

Specifically, document behavior when type instantiation leads to duplicate entries in the switch.

From conversation with @danscales:

I think you may want to specify that a type parameter can be one of the types used in the type(s) of a case, as long as the typeparam satisfies the type of x (based on its bound). You may want to mention explicitly that there may be duplicate cases after instantiation of a generic function/method with type args, and that is fine. So, then, the first case matched is chosen. Duplicate cases are only checked before instantiation.

cc: @danscales

@griesemer griesemer added this to the Go1.18 milestone Feb 9, 2022
@griesemer griesemer self-assigned this Feb 9, 2022
Copy link

Copy link

Change mentions this issue: spec: document behavior of generic type switch cases

@golang golang locked and limited conversation to collaborators Jun 22, 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

3 participants