Commit 47c3049
committed
Select a type class instance by type identity, not by printed name
The fallback registry keyed implementations on the printed type. A class prints
as its simple name, so two classes of the same name in different packages
collided: the second registration was dropped and its values silently dispatched
through the first's implementation, with no error. Implementations are now held
per requirement and matched by structural type equality.
The printed form also fed those keys and reaches specialization names, while the
binding it prints is a hash map, so identical input could produce different
symbols between runs. The names are sorted, and with the keys no longer built
from text the printing is once again only for reading.1 parent 2ec9571 commit 47c3049
3 files changed
Lines changed: 86 additions & 20 deletions
File tree
- de.peeeq.wurstscript/src
- main/java/de/peeeq/wurstscript/translation/imtranslation
- test/java/tests/wurstscript/tests
Lines changed: 10 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
545 | 547 | | |
546 | 548 | | |
547 | 549 | | |
548 | | - | |
549 | | - | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
550 | 554 | | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
| 555 | + | |
556 | 556 | | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
557 | 560 | | |
558 | 561 | | |
559 | 562 | | |
| |||
Lines changed: 29 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1714 | 1714 | | |
1715 | 1715 | | |
1716 | 1716 | | |
1717 | | - | |
| 1717 | + | |
| 1718 | + | |
1718 | 1719 | | |
1719 | 1720 | | |
1720 | 1721 | | |
1721 | 1722 | | |
1722 | | - | |
1723 | | - | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
1724 | 1729 | | |
1725 | | - | |
| 1730 | + | |
1726 | 1731 | | |
1727 | | - | |
1728 | | - | |
1729 | | - | |
| 1732 | + | |
1730 | 1733 | | |
1731 | 1734 | | |
1732 | | - | |
1733 | | - | |
1734 | | - | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
1735 | 1743 | | |
1736 | 1744 | | |
1737 | | - | |
1738 | | - | |
1739 | | - | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
1740 | 1756 | | |
1741 | 1757 | | |
1742 | 1758 | | |
| |||
Lines changed: 47 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
800 | 800 | | |
801 | 801 | | |
802 | 802 | | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
803 | 850 | | |
804 | 851 | | |
805 | 852 | | |
| |||
0 commit comments