Skip to content

Commit b650010

Browse files
authored
meeting commentary (dotnet#1017)
Follow up to dotnet#1012
1 parent 0409dfa commit b650010

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

standard/variables.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -333,17 +333,7 @@ The definite-assignment state of *v* at the beginning of a case’s guard clause
333333
- If the switch label containing that guard clause ([§13.8.3](statements.md#1383-the-switch-statement)) is not reachable: “definitely assigned”.
334334
- Otherwise, the state of *v* is the same as the state of *v* after *expr*.
335335
336-
The definite-assignment state of *v* on the control flow transfer to a reachable switch block statement list is
337-
338-
- If the control transfer was due to a ‘goto case’ or ‘goto default’ statement, then the state of *v* is the same as the state at the beginning of that ‘goto’ statement.
339-
- If the control transfer was due to the `default` label of the switch, then the state of *v* is the same as the state of *v* after *expr*.
340-
- If the control transfer was due to an unreachable switch label, then the state of *v* is “definitely assigned”.
341-
- If the control transfer was due to a reachable switch label with a guard clause, then the state of *v* is the same as the state of *v* after the guard clause.
342-
- If the control transfer was due to a reachable switch label without a guard clause, then the state of *v* is
343-
- If *v* is a pattern variable declared in the *switch_label*: “definitely assigned”.
344-
- Otherwise, the state of *v* is the same as the stat of *v* after *expr*.
345-
346-
> *Example*: The third rule eliminates the need for the compiler to issue an error if an unassigned variable is accessed in unreachable code. The state of *b* is "definitely assigned" in the unreachable switch label `case 2 when b`.
336+
> *Example*: The second rule eliminates the need for the compiler to issue an error if an unassigned variable is accessed in unreachable code. The state of *b* is "definitely assigned" in the unreachable switch label `case 2 when b`.
347337
>
348338
> ```csharp
349339
> bool b;
@@ -356,6 +346,16 @@ The definite-assignment state of *v* on the control flow transfer to a reachable
356346
>
357347
> *end example*
358348
349+
The definite-assignment state of *v* on the control flow transfer to a reachable switch block statement list is
350+
351+
- If the control transfer was due to a ‘goto case’ or ‘goto default’ statement, then the state of *v* is the same as the state at the beginning of that ‘goto’ statement.
352+
- If the control transfer was due to the `default` label of the switch, then the state of *v* is the same as the state of *v* after *expr*.
353+
- If the control transfer was due to an unreachable switch label, then the state of *v* is “definitely assigned”.
354+
- If the control transfer was due to a reachable switch label with a guard clause, then the state of *v* is the same as the state of *v* after the guard clause.
355+
- If the control transfer was due to a reachable switch label without a guard clause, then the state of *v* is
356+
- If *v* is a pattern variable declared in the *switch_label*: “definitely assigned”.
357+
- Otherwise, the state of *v* is the same as the stat of *v* after *expr*.
358+
359359
A consequence of these rules is that a pattern variable declared in a *switch_label* will be “not definitely assigned” in the statements of its switch section if it is not the only reachable switch label in its section.
360360
361361
> *Example*:

0 commit comments

Comments
 (0)