Commit ba3e523
Fix stack overflow with mutually recursive type aliases
Summary:
Fixes #2982
Cyclic type aliases like type T = U; type U = T were correctly detected and reported as errors, but the cyclic UntypedAlias(Ref(...)) was still emitted as the alias's type. Downstream operations (attribute lookup, subset checks) would then infinitely bounce between the two refs, overflowing the stack. Fix: when check_type_alias_for_cyclic_reference finds a cycle, short-circuit wrap_type_alias to return an error type instead of the cyclic body. {F1987625179}
Reviewed By: rchen152
Differential Revision: D99314495
fbshipit-source-id: 87937d7fca8c556eaadb641160a23cfc63b0a5a81 parent c08dfa0 commit ba3e523
2 files changed
Lines changed: 24 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1252 | 1252 | | |
1253 | 1253 | | |
1254 | 1254 | | |
| 1255 | + | |
1255 | 1256 | | |
1256 | 1257 | | |
1257 | 1258 | | |
1258 | 1259 | | |
1259 | 1260 | | |
1260 | 1261 | | |
1261 | | - | |
| 1262 | + | |
1262 | 1263 | | |
1263 | 1264 | | |
1264 | 1265 | | |
| |||
1267 | 1268 | | |
1268 | 1269 | | |
1269 | 1270 | | |
1270 | | - | |
| 1271 | + | |
1271 | 1272 | | |
1272 | 1273 | | |
1273 | 1274 | | |
| |||
1338 | 1339 | | |
1339 | 1340 | | |
1340 | 1341 | | |
| 1342 | + | |
1341 | 1343 | | |
| 1344 | + | |
1342 | 1345 | | |
1343 | 1346 | | |
1344 | 1347 | | |
| |||
1371 | 1374 | | |
1372 | 1375 | | |
1373 | 1376 | | |
1374 | | - | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
1375 | 1383 | | |
1376 | 1384 | | |
1377 | 1385 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
261 | 274 | | |
262 | 275 | | |
263 | 276 | | |
| |||
0 commit comments