Skip to content

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

@griesemer

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

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