Commit 23ee291
Unify enum and union member comparison types (#55377)
Summary:
Pull Request resolved: #55377
Simplifies the member comparison logic by consolidating enum and union member types into a single discriminated union. This reduces code duplication and makes the comparison result handling more uniform across the codebase, as both member types now follow the same pattern with a `memberKind` discriminator.
When D86501597 was added, we couldn't come up with an easy way to converge these, so it was easier to just duplicate the code path for enum for unions. It always felt like a smell to me though, because they are so similar. AI was able to find a good way to converge them.
Changelog: [Internal]
Reviewed By: makovkastar
Differential Revision: D91296850
fbshipit-source-id: 5a1baf1c8149f0c6c9c72c0dce9ea093f71e39cd1 parent 9907a06 commit 23ee291
7 files changed
Lines changed: 141 additions & 271 deletions
File tree
- packages/react-native-compatibility-check/src
- __tests__
- __snapshots__
Lines changed: 6 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
| 105 | + | |
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
| |||
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
| 114 | + | |
113 | 115 | | |
114 | 116 | | |
115 | 117 | | |
116 | 118 | | |
117 | 119 | | |
118 | 120 | | |
119 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
120 | 125 | | |
121 | 126 | | |
122 | 127 | | |
| |||
150 | 155 | | |
151 | 156 | | |
152 | 157 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | 187 | | |
194 | 188 | | |
195 | 189 | | |
| |||
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 26 | + | |
| 27 | + | |
30 | 28 | | |
31 | 29 | | |
32 | 30 | | |
| |||
Lines changed: 14 additions & 45 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | | - | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
| 328 | + | |
355 | 329 | | |
356 | 330 | | |
357 | 331 | | |
| |||
501 | 475 | | |
502 | 476 | | |
503 | 477 | | |
504 | | - | |
505 | 478 | | |
506 | 479 | | |
507 | 480 | | |
| |||
675 | 648 | | |
676 | 649 | | |
677 | 650 | | |
678 | | - | |
| 651 | + | |
679 | 652 | | |
680 | | - | |
| 653 | + | |
681 | 654 | | |
682 | | - | |
| 655 | + | |
683 | 656 | | |
684 | | - | |
| 657 | + | |
685 | 658 | | |
686 | 659 | | |
687 | 660 | | |
| |||
702 | 675 | | |
703 | 676 | | |
704 | 677 | | |
705 | | - | |
| 678 | + | |
706 | 679 | | |
707 | 680 | | |
708 | 681 | | |
| |||
718 | 691 | | |
719 | 692 | | |
720 | 693 | | |
721 | | - | |
722 | 694 | | |
723 | 695 | | |
724 | 696 | | |
| |||
753 | 725 | | |
754 | 726 | | |
755 | 727 | | |
756 | | - | |
| 728 | + | |
757 | 729 | | |
758 | | - | |
| 730 | + | |
759 | 731 | | |
760 | | - | |
| 732 | + | |
761 | 733 | | |
762 | 734 | | |
763 | 735 | | |
| |||
777 | 749 | | |
778 | 750 | | |
779 | 751 | | |
780 | | - | |
781 | | - | |
| 752 | + | |
| 753 | + | |
782 | 754 | | |
783 | 755 | | |
784 | 756 | | |
| |||
799 | 771 | | |
800 | 772 | | |
801 | 773 | | |
802 | | - | |
803 | 774 | | |
804 | 775 | | |
805 | 776 | | |
| |||
984 | 955 | | |
985 | 956 | | |
986 | 957 | | |
987 | | - | |
| 958 | + | |
988 | 959 | | |
989 | 960 | | |
990 | 961 | | |
| |||
1018 | 989 | | |
1019 | 990 | | |
1020 | 991 | | |
1021 | | - | |
| 992 | + | |
1022 | 993 | | |
1023 | 994 | | |
1024 | 995 | | |
| |||
1212 | 1183 | | |
1213 | 1184 | | |
1214 | 1185 | | |
1215 | | - | |
1216 | 1186 | | |
1217 | 1187 | | |
1218 | 1188 | | |
| |||
1315 | 1285 | | |
1316 | 1286 | | |
1317 | 1287 | | |
1318 | | - | |
1319 | 1288 | | |
1320 | 1289 | | |
1321 | 1290 | | |
| |||
0 commit comments