Commit 10b48a3
authored
Fix match exhaustiveness for tuples of aliased unions (#5193)
PR #5145 stopped expanding type aliases during name resolution, so a
type alias now persists as TK_TYPEALIASREF in places where it used to
be replaced by its underlying form. Every subtype dispatch site was
updated to unfold TK_TYPEALIASREF on demand, except for
expand_type_alternatives, which is how tuple-of-union subtype checks
distribute a tuple over its element unions for match exhaustiveness.
Without the unfold, a tuple element that is a type alias was treated
as a single opaque alternative instead of the union it wraps, so
(PRF, PRF) over a four-case match (where PRF is (String | U64)) no
longer looked exhaustive. Add the TK_TYPEALIASREF case to
expand_type_alternatives and a regression test pair covering both
the exhaustive and non-exhaustive shapes.
This is a regression against unreleased code, so no changelog or
release notes entry.1 parent 527c200 commit 10b48a3
2 files changed
+62
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
556 | 556 | | |
557 | 557 | | |
558 | 558 | | |
| 559 | + | |
559 | 560 | | |
560 | 561 | | |
561 | 562 | | |
| |||
644 | 645 | | |
645 | 646 | | |
646 | 647 | | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
647 | 664 | | |
648 | 665 | | |
649 | 666 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
755 | 755 | | |
756 | 756 | | |
757 | 757 | | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
758 | 803 | | |
759 | 804 | | |
760 | 805 | | |
| |||
0 commit comments