@@ -2,24 +2,38 @@ predicateSemantics.ts(7,16): error TS2871: This expression is always nullish.
22predicateSemantics.ts(10,16): error TS2869: Right operand of ?? is unreachable because the left operand is never nullish.
33predicateSemantics.ts(26,13): error TS2869: Right operand of ?? is unreachable because the left operand is never nullish.
44predicateSemantics.ts(27,13): error TS2869: Right operand of ?? is unreachable because the left operand is never nullish.
5+ predicateSemantics.ts(29,13): error TS2871: This expression is always nullish.
56predicateSemantics.ts(30,13): error TS2872: This kind of expression is always truthy.
67predicateSemantics.ts(31,13): error TS2872: This kind of expression is always truthy.
8+ predicateSemantics.ts(32,13): error TS2871: This expression is always nullish.
9+ predicateSemantics.ts(32,13): error TS2871: This expression is always nullish.
710predicateSemantics.ts(32,21): error TS2871: This expression is always nullish.
8- predicateSemantics.ts(34,20): error TS2871: This expression is always nullish.
9- predicateSemantics.ts(35,20): error TS2871: This expression is always nullish.
10- predicateSemantics.ts(38,29): error TS2871: This expression is always nullish.
11- predicateSemantics.ts(40,22): error TS2871: This expression is always nullish.
11+ predicateSemantics.ts(34,13): error TS2871: This expression is always nullish.
12+ predicateSemantics.ts(34,13): error TS2871: This expression is always nullish.
13+ predicateSemantics.ts(34,22): error TS2871: This expression is always nullish.
14+ predicateSemantics.ts(36,20): error TS2871: This expression is always nullish.
15+ predicateSemantics.ts(37,20): error TS2871: This expression is always nullish.
16+ predicateSemantics.ts(39,21): error TS2871: This expression is always nullish.
17+ predicateSemantics.ts(40,21): error TS2871: This expression is always nullish.
18+ predicateSemantics.ts(40,21): error TS2871: This expression is always nullish.
19+ predicateSemantics.ts(40,29): error TS2871: This expression is always nullish.
1220predicateSemantics.ts(41,21): error TS2871: This expression is always nullish.
13- predicateSemantics.ts(41,29): error TS2871: This expression is always nullish.
14- predicateSemantics.ts(42,21): error TS2874: This expression is never nullish.
15- predicateSemantics.ts(43,22): error TS2874: This expression is never nullish.
16- predicateSemantics.ts(46,8): error TS2872: This kind of expression is always truthy.
17- predicateSemantics.ts(47,11): error TS2872: This kind of expression is always truthy.
18- predicateSemantics.ts(48,8): error TS2872: This kind of expression is always truthy.
19- predicateSemantics.ts(49,8): error TS2872: This kind of expression is always truthy.
21+ predicateSemantics.ts(42,13): error TS2869: Right operand of ?? is unreachable because the left operand is never nullish.
22+ predicateSemantics.ts(43,13): error TS2869: Right operand of ?? is unreachable because the left operand is never nullish.
23+ predicateSemantics.ts(45,13): error TS2871: This expression is always nullish.
24+ predicateSemantics.ts(45,13): error TS2871: This expression is always nullish.
25+ predicateSemantics.ts(45,13): error TS2871: This expression is always nullish.
26+ predicateSemantics.ts(45,21): error TS2871: This expression is always nullish.
27+ predicateSemantics.ts(45,29): error TS2871: This expression is always nullish.
28+ predicateSemantics.ts(46,13): error TS2869: Right operand of ?? is unreachable because the left operand is never nullish.
29+ predicateSemantics.ts(47,13): error TS2869: Right operand of ?? is unreachable because the left operand is never nullish.
30+ predicateSemantics.ts(50,8): error TS2872: This kind of expression is always truthy.
31+ predicateSemantics.ts(51,11): error TS2872: This kind of expression is always truthy.
32+ predicateSemantics.ts(52,8): error TS2872: This kind of expression is always truthy.
33+ predicateSemantics.ts(53,8): error TS2872: This kind of expression is always truthy.
2034
2135
22- ==== predicateSemantics.ts (19 errors) ====
36+ ==== predicateSemantics.ts (33 errors) ====
2337 declare let opt: number | undefined;
2438
2539 // OK: One or other operand is possibly nullish
@@ -57,15 +71,29 @@ predicateSemantics.ts(49,8): error TS2872: This kind of expression is always tru
5771!!! error TS2869: Right operand of ?? is unreachable because the left operand is never nullish.
5872 const p03 = null ?? 1;
5973 const p04 = null ?? null;
74+ ~~~~~~~~~~~~
75+ !!! error TS2871: This expression is always nullish.
6076 const p05 = (class foo { }) && null;
6177 ~~~~~~~~~~~~~~~
6278!!! error TS2872: This kind of expression is always truthy.
6379 const p06 = (class foo { }) || null;
6480 ~~~~~~~~~~~~~~~
6581!!! error TS2872: This kind of expression is always truthy.
6682 const p07 = null ?? null ?? null;
83+ ~~~~~~~~~~~~
84+ !!! error TS2871: This expression is always nullish.
85+ ~~~~~~~~~~~~~~~~~~~~
86+ !!! error TS2871: This expression is always nullish.
6787 ~~~~
6888!!! error TS2871: This expression is always nullish.
89+ const p08 = null ?? opt ?? null;
90+ const p09 = null ?? (opt ? null : undefined) ?? null;
91+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92+ !!! error TS2871: This expression is always nullish.
93+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
94+ !!! error TS2871: This expression is always nullish.
95+ ~~~~~~~~~~~~~~~~~~~~~~
96+ !!! error TS2871: This expression is always nullish.
6997
7098 const p10 = opt ?? null ?? 1;
7199 ~~~~
@@ -75,24 +103,42 @@ predicateSemantics.ts(49,8): error TS2872: This kind of expression is always tru
75103!!! error TS2871: This expression is always nullish.
76104 const p12 = opt ?? (null ?? 1);
77105 const p13 = opt ?? (null ?? null);
106+ ~~~~~~~~~~~~
107+ !!! error TS2871: This expression is always nullish.
78108 const p14 = opt ?? (null ?? null ?? null);
109+ ~~~~~~~~~~~~
110+ !!! error TS2871: This expression is always nullish.
111+ ~~~~~~~~~~~~~~~~~~~~
112+ !!! error TS2871: This expression is always nullish.
79113 ~~~~
80114!!! error TS2871: This expression is always nullish.
81-
82- const p20 = null ?? (opt ? null : undefined) ?? null;
83- ~~~~~~~~~~~~~~~~~~~~~~
115+ const p15 = opt ?? (opt ? null : undefined) ?? null;
116+ ~~~~~~~~~~~~~~~~~~~~~~
84117!!! error TS2871: This expression is always nullish.
118+ const p16 = opt ?? 1 ?? 2;
119+ ~~~~~~~~
120+ !!! error TS2869: Right operand of ?? is unreachable because the left operand is never nullish.
121+ const p17 = opt ?? (opt ? 1 : 2) ?? 3;
122+ ~~~~~~~~~~~~~~~~~~~~
123+ !!! error TS2869: Right operand of ?? is unreachable because the left operand is never nullish.
124+
85125 const p21 = null ?? null ?? null ?? null;
126+ ~~~~~~~~~~~~
127+ !!! error TS2871: This expression is always nullish.
128+ ~~~~~~~~~~~~~~~~~~~~
129+ !!! error TS2871: This expression is always nullish.
130+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
131+ !!! error TS2871: This expression is always nullish.
86132 ~~~~
87133!!! error TS2871: This expression is always nullish.
88134 ~~~~
89135!!! error TS2871: This expression is always nullish.
90136 const p22 = null ?? 1 ?? 1;
91- ~
92- !!! error TS2874: This expression is never nullish.
137+ ~~~~~~~~ ~
138+ !!! error TS2869: Right operand of ?? is unreachable because the left operand is never nullish.
93139 const p23 = null ?? (opt ? 1 : 2) ?? 1;
94- ~~~~~~~~~~~
95- !!! error TS2874: This expression is never nullish.
140+ ~~~~~~~~~~ ~~~~~~~~~~~
141+ !!! error TS2869: Right operand of ?? is unreachable because the left operand is never nullish.
96142
97143 // Outer expression tests
98144 while ({} as any) { }
0 commit comments