@@ -430,13 +430,13 @@ Definitions:
430
430
- otherwise ` demoted ` is ` previous `
431
431
432
432
- ` promote(E, T, M) ` where ` E ` is an expression, ` T ` is a type which it may be
433
- promoted to, and ` M = FlowModel(r, VI)` is the flow model in which to promote,
434
- is defined as follows :
435
- - If ` E ` is not a promotion target, then ` M `
433
+ promoted to, and ` M1 = FlowModel(r, VI)` is the flow model in which to
434
+ promote, is defined to be ` M3 ` , where :
435
+ - If ` E ` is not a promotion target, then ` M3 ` = ` M1 `
436
436
- If ` E ` is a promotion target ` x ` , then
437
437
- Let `VM = VariableModel(declared, promoted, tested, assigned, unassigned,
438
438
captured)` be the variable model for ` x` in ` VI`
439
- - If ` x ` is not promotable via type test to ` T ` given ` VM ` , then return ` M `
439
+ - If ` x ` is not promotable via type test to ` T ` given ` VM ` , then ` M3 ` = ` M1 `
440
440
- Else
441
441
- Let ` S ` be the current type of ` x ` in ` VM `
442
442
- If ` T <: S ` then let ` T1 ` = ` T `
@@ -445,7 +445,8 @@ Definitions:
445
445
- Else ` x ` is not promotable (shouldn't happen since we checked above)
446
446
- Let `VM2 = VariableModel(declared, T1::promoted, T1::tested, assigned,
447
447
unassigned, captured)`
448
- - Return ` FlowModel(r, VI[x -> VM2]) `
448
+ - Let ` M2 = FlowModel(r, VI[x -> VM2]) `
449
+ - If ` T1 <: Never ` then ` M3 ` = ` unreachable(M2) ` , otherwise ` M3 ` = ` M2 `
449
450
- ` promoteToNonNull(E, M) ` where ` E ` is an expression and ` M ` is a flow model is
450
451
defined to be ` promote(E, T, M) ` where ` T0 ` is the type of ` E ` , and ` T ` is
451
452
** NonNull(` T0 ` )** .
0 commit comments