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

Closed
griesemer opened this issue Feb 9, 2022 · 2 comments
Closed
Milestone

Comments

@griesemer
Copy link
Contributor

griesemer commented Feb 9, 2022

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
@ianlancetaylor
Copy link
Contributor

ianlancetaylor commented Feb 9, 2022

@gopherbot
Copy link

gopherbot commented Feb 9, 2022

Change https://go.dev/cl/384674 mentions this issue: spec: document behavior of generic type switch cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants