Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate prelude imports from star imports #6971

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jjcnn
Copy link
Contributor

@jjcnn jjcnn commented Feb 28, 2025

Description

Fixes #6119 .

Currently, items implicitly imported from the standard library preludes reside in the same namespace as star imports from non-prelude sources. This means that if a star import imports a name that clashes with a name from a prelude, then using that name in the importing module causes an error.

This PR separates the prelude imports into a different namespace, and allows star imports to shadow prelude imports.

Remaining tasks:

  • Introduce test that shadowing works.

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@jjcnn jjcnn self-assigned this Feb 28, 2025
@jjcnn jjcnn added the team:compiler Compiler Team label Feb 28, 2025
Copy link

codspeed-hq bot commented Feb 28, 2025

CodSpeed Performance Report

Merging #6971 will not alter performance

Comparing jjcnn/prelude_overridden_by_star_import (47f392f) with master (b7d1539)

Summary

✅ 22 untouched benchmarks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:compiler Compiler Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Star imports should shadow prelude imports
1 participant