You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: standard/expressions.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3889,7 +3889,7 @@ If a switch expression is not subject to a *switch expression conversion*, then
3889
3889
- The type of the *switch_expression* is the best common type [§12.6.3.16](expressions.md#126316-finding-the-best-common-type-of-a-set-of-expressions)) of the *switch_expression_arm_expression*s of the *switch_expression_arm*s, if such a type exists, and each *switch_expression_arm_expression* can be implicitly converted to that type.
3890
3890
- It is an error if no such type exists.
3891
3891
3892
-
It is an error if the pattern of any *switch_expression_arm* is *subsumed* by (§11.1) the set of patterns of earlier *unguarded* ([§13.8.3](statements.md#1383-the-switch-statement)) *switch_expression_arm*s of the switch expression.
3892
+
It is an error if the pattern of any *switch_expression_arm* is *subsumed* by ([§11.1](patterns.md#111-general)) the set of patterns of earlier *unguarded* ([§13.8.3](statements.md#1383-the-switch-statement)) *switch_expression_arm*s of the switch expression.
3893
3893
3894
3894
A switch expression is *exhaustive* if every value of its input is handled by at least one arm of the switch expression. A warning may be issued if a switch expression is not exhaustive.
Copy file name to clipboardExpand all lines: standard/statements.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -753,7 +753,7 @@ There can be at most one `default` label in a `switch` statement.
753
753
754
754
It is an error if the pattern of any switch label is not *applicable* ([§11.2.1](patterns.md#1121-general)) to the type of the input expression.
755
755
756
-
It is an error if the pattern of any switch label is *subsumed* by (§11.1) the set of patterns of earlier *unguarded* switch labels of the switch statement.
756
+
It is an error if the pattern of any switch label is *subsumed* by ([§11.1](patterns.md#111-general)) the set of patterns of earlier *unguarded* switch labels of the switch statement.
757
757
758
758
> *Example*:
759
759
>
@@ -949,7 +949,7 @@ A switch label is reachable if at least one of the following is true:
949
949
- The switch’s *selector_expression* is not a constant value and either
950
950
- the label is a `case` without a guard or with a guard whose value is not the constant false; or
951
951
- it is a `default` label and
952
-
- the set of patterns appearing among the cases of the switch statement that do not have guards or have guards whose value is the constant true, is not *exhaustive* (§11.1) for the switch governing type; or
952
+
- the set of patterns appearing among the cases of the switch statement that do not have guards or have guards whose value is the constant true, is not *exhaustive* ([§11.1](patterns.md#111-general)) for the switch governing type; or
953
953
- the switch governing type is a nullable type and the set of patterns appearing among the cases of the switch statement that do not have guards or have guards whose value is the constant true does not contain a pattern that would match the value `null`.
954
954
- The switch label is referenced by a reachable `goto case` or `goto default` statement.
955
955
@@ -959,7 +959,7 @@ The end point of a `switch` statement is reachable if the switch statement is re
959
959
960
960
- The `switch` statement contains a reachable `break` statement that exits the `switch` statement.
961
961
- No `default` label is present and either
962
-
- The switch’s *selector_expression* is a non-constant value, and the set of patterns appearing among the cases of the switch statement that do not have guards or have guards whose value is the constant true, is not *exhaustive* (§11.1) for the switch governing type.
962
+
- The switch’s *selector_expression* is a non-constant value, and the set of patterns appearing among the cases of the switch statement that do not have guards or have guards whose value is the constant true, is not *exhaustive* ([§11.1](patterns.md#111-general)) for the switch governing type.
963
963
- The switch’s *selector_expression* is a non-constant value of a nullable type, and no pattern appearing among the cases of the switch statement that do not have guards or have guards whose value is the constant true would match the value `null`.
964
964
- The switch’s *selector_expression* is a constant value and no `case` label without a guard or whose guard is the constant true would match that value.
0 commit comments