Commit c0561ac
Carry an enum's enumerators as the constants they already are
PRIK models a Fortran enumerator as a constant `SemanticVariable`, but the
accessibility and re-export inventory never looked at `module.enums`.
`_module_declared_names()` listed procedures, derived types, variables and
interfaces, so a plain `use` of a module declaring `enumerator :: red = 1`
carried nothing for `red`. `_declared_entity_kind()` likewise did not
recognize one, so `use colors, only : red` produced a re-export of kind
`unknown` -- which a contract may still publish while the module-variable
publication machinery, which attaches a second namespace only to a re-export
classified `variable`, passes it by.
Read enumerators wherever this layer reads a module's variables, as the
variables they become. `_module_declaration_dependencies()` reads their
initializers too, so an enumerator whose value names an imported constant
records that constant as a declaration dependency rather than a publication.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DN6oB7jC7wZXgFmuec4B7Q1 parent aabd16d commit c0561ac
3 files changed
Lines changed: 89 additions & 0 deletions
File tree
- prik/semantics
- tests/fortran/modules/semantics
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
10 | 18 | | |
11 | 19 | | |
12 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1694 | 1694 | | |
1695 | 1695 | | |
1696 | 1696 | | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
1697 | 1709 | | |
1698 | 1710 | | |
1699 | 1711 | | |
| |||
1703 | 1715 | | |
1704 | 1716 | | |
1705 | 1717 | | |
| 1718 | + | |
| 1719 | + | |
1706 | 1720 | | |
1707 | 1721 | | |
1708 | 1722 | | |
1709 | 1723 | | |
1710 | 1724 | | |
| 1725 | + | |
1711 | 1726 | | |
1712 | 1727 | | |
1713 | 1728 | | |
| |||
1779 | 1794 | | |
1780 | 1795 | | |
1781 | 1796 | | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
1782 | 1801 | | |
1783 | 1802 | | |
1784 | 1803 | | |
| |||
2009 | 2028 | | |
2010 | 2029 | | |
2011 | 2030 | | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
2012 | 2035 | | |
2013 | 2036 | | |
2014 | 2037 | | |
| |||
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
714 | 714 | | |
715 | 715 | | |
716 | 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 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
0 commit comments