Skip to content

fix(compiler): retain enum prefixes for containment - #3449

Closed
adilalperenciftci wants to merge 1 commit into
aether-lang-dev:mainfrom
adilalperenciftci:fix/enum-containment-prefix
Closed

adilalperenciftci wants to merge 1 commit into
aether-lang-dev:mainfrom
adilalperenciftci:fix/enum-containment-prefix

Conversation

@adilalperenciftci

Copy link
Copy Markdown
Contributor

Summary

I traced a lexical-containment mismatch to enum lowering. Color.Red was rewritten to the generated identifier Color_Red before block scopes were checked. As a result, hide Color did not block the access, while seal except Color rejected a prefix the source had explicitly whitelisted.

This change preserves the source enum prefix as lowering metadata and uses it for hide/seal checks. Once the prefix passes containment, the generated constant is resolved without applying the block policy a second time to its C name.

Verification

  • BEFORE: hide Color accepted Color.Red; seal except Color rejected it.
  • AFTER: hidden and sealed-out prefixes reject with the source name, and a whitelisted prefix compiles.
  • sh tests/integration/enum_containment/test_enum_containment.sh
  • ./build/ae run tests/regression/test_enum_implicit_selector.ae
  • ./build/ae run tests/regression/test_enum_basic.ae
  • make check-changelog
  • make check-tests
  • make test (634 passed)

Signed-off-by: Adil Alperen Çiftci adilalperenciftci@users.noreply.github.com

Signed-off-by: Adil Alperen Çiftci <adilalperenciftci@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 29, 2026 08:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@paul-hammant

Copy link
Copy Markdown
Collaborator

Thanks @adilalperenciftci! This landed in #3474, which batched nine of your PRs and merged on 2026-10-30 (ca1dae7d). Your commit went in unchanged with your authorship, so this PR is superseded, and I'm closing it.

On top of your commit, #3474 enlarges the enum-prefix message buffer in typechecker.c to 640 bytes: gcc's -Werror=format-truncation refused a 511-byte prefix formatted into the 256-byte buffer on the Linux gate. No behaviour change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants