Skip to content

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

Closed

Description

@griesemer

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

Activity

  1. added this to the Go1.18 milestone on Feb 9, 2022
  2. self-assigned this
    on Feb 9, 2022
  3. gopherbot commented on Feb 9, 2022

    @gopherbot
    Contributor

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

  4. locked and limited conversation to collaborators on Jun 22, 2023
  5. added a commit that references this issue on Apr 29, 2024
    9867262
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions