Repository navigation
Commit 620f184
committed
Make flow analysis of a reference independent of other references
When one reference hit the flow analysis depth limit, flow analysis
was disabled for every later reference in the same function or module
body, so the type of a reference depended on whether another reference
in the body had been analyzed before it. Each reference now gives up
only when its own analysis hits the limit.
Shared flow node results are cached for the duration of one flow
analysis, including incomplete results computed under a loop back
edge. Once that loop's back edge has been exited and the loop label
has a complete type, they are stale. Reusing them made a reference's
type depend on which reference was analyzed first: in
exhaustiveSwitchCheckCircularity, querying the reference inside the
loop before the switch expression produced `never` instead of "bbb".
An incomplete shared result is now reused only while the loop that
was innermost when it was computed is still being analyzed.1 parent 8525b16 commit 620f184
5 files changed
Lines changed: 2016 additions & 2019 deletions
File tree
- tsc
- internal/checker
- testdata/baselines/reference/compiler
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
845 | 845 | | |
846 | 846 | | |
847 | 847 | | |
848 | | - | |
849 | 848 | | |
850 | 849 | | |
851 | 850 | | |
| |||
3867 | 3866 | | |
3868 | 3867 | | |
3869 | 3868 | | |
3870 | | - | |
3871 | | - | |
3872 | | - | |
3873 | | - | |
3874 | | - | |
3875 | | - | |
3876 | | - | |
| 3869 | + | |
3877 | 3870 | | |
3878 | 3871 | | |
3879 | 3872 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | 82 | | |
86 | 83 | | |
87 | 84 | | |
| |||
117 | 114 | | |
118 | 115 | | |
119 | 116 | | |
120 | | - | |
| 117 | + | |
| 118 | + | |
121 | 119 | | |
122 | 120 | | |
123 | 121 | | |
124 | | - | |
125 | 122 | | |
126 | 123 | | |
127 | 124 | | |
| |||
134 | 131 | | |
135 | 132 | | |
136 | 133 | | |
137 | | - | |
| 134 | + | |
138 | 135 | | |
139 | | - | |
| 136 | + | |
140 | 137 | | |
141 | 138 | | |
142 | 139 | | |
| |||
1364 | 1361 | | |
1365 | 1362 | | |
1366 | 1363 | | |
| 1364 | + | |
1367 | 1365 | | |
1368 | 1366 | | |
1369 | 1367 | | |
1370 | 1368 | | |
1371 | 1369 | | |
1372 | 1370 | | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
1373 | 1377 | | |
1374 | 1378 | | |
1375 | 1379 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
0 commit comments