Commit 7a6f0b9
[flow][tslib] Fix LocEnvEntryNotFound crash for destructuring in function type params
Summary:
D97435945 added parser support for destructuring patterns in arrow function
type params (e.g. `type A = ({ a, b }: T) => R`). The env builder's
`function_param_type_pattern` override was skipping the entire pattern,
which correctly avoided creating runtime bindings for the destructured
identifiers but also skipped visiting the type annotation. This caused
type references like `T` to never be registered in `env_values`, leading
to `LocEnvEntryNotFound` crashes during type checking.
Fix: visit the type annotation hint on destructuring patterns in function
type params while still skipping the binding identifiers.
Changelog: [internal]
Reviewed By: panagosg7
Differential Revision: D98849947
fbshipit-source-id: 83541ef14ae803128659c60725d1c744b8e4a97d1 parent a90f777 commit 7a6f0b9
File tree
7 files changed
+139
-12
lines changed- rust_port/crates/flow_env_builder_resolver/src
- src/analysis/env_builder
- tests/tslib_syntax
7 files changed
+139
-12
lines changedLines changed: 10 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1101 | 1101 | | |
1102 | 1102 | | |
1103 | 1103 | | |
| 1104 | + | |
1104 | 1105 | | |
1105 | 1106 | | |
1106 | | - | |
| 1107 | + | |
1107 | 1108 | | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
1108 | 1117 | | |
1109 | 1118 | | |
1110 | 1119 | | |
| |||
Lines changed: 20 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10342 | 10342 | | |
10343 | 10343 | | |
10344 | 10344 | | |
| 10345 | + | |
10345 | 10346 | | |
10346 | 10347 | | |
10347 | | - | |
| 10348 | + | |
10348 | 10349 | | |
| 10350 | + | |
| 10351 | + | |
| 10352 | + | |
| 10353 | + | |
| 10354 | + | |
| 10355 | + | |
| 10356 | + | |
| 10357 | + | |
10349 | 10358 | | |
10350 | 10359 | | |
10351 | 10360 | | |
| |||
11014 | 11023 | | |
11015 | 11024 | | |
11016 | 11025 | | |
| 11026 | + | |
11017 | 11027 | | |
11018 | 11028 | | |
11019 | | - | |
| 11029 | + | |
11020 | 11030 | | |
| 11031 | + | |
| 11032 | + | |
| 11033 | + | |
| 11034 | + | |
| 11035 | + | |
| 11036 | + | |
| 11037 | + | |
| 11038 | + | |
11021 | 11039 | | |
11022 | 11040 | | |
11023 | 11041 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
402 | | - | |
403 | | - | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
404 | 414 | | |
405 | 415 | | |
406 | 416 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2211 | 2211 | | |
2212 | 2212 | | |
2213 | 2213 | | |
2214 | | - | |
2215 | | - | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
2216 | 2226 | | |
2217 | 2227 | | |
2218 | 2228 | | |
| |||
6956 | 6966 | | |
6957 | 6967 | | |
6958 | 6968 | | |
6959 | | - | |
6960 | | - | |
| 6969 | + | |
| 6970 | + | |
| 6971 | + | |
| 6972 | + | |
| 6973 | + | |
| 6974 | + | |
| 6975 | + | |
| 6976 | + | |
| 6977 | + | |
| 6978 | + | |
| 6979 | + | |
| 6980 | + | |
6961 | 6981 | | |
6962 | 6982 | | |
6963 | 6983 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
701 | 701 | | |
702 | 702 | | |
703 | 703 | | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
704 | 756 | | |
705 | 757 | | |
706 | 758 | | |
| |||
1378 | 1430 | | |
1379 | 1431 | | |
1380 | 1432 | | |
1381 | | - | |
| 1433 | + | |
0 commit comments