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

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

jjcnn
Copy link
Contributor

@jjcnn jjcnn commented Feb 28, 2025

Description

Fixes #6119 .

Blocked by #6729, sort of. The failing CI checks are due to the sway-lsp tests being pinned to std v0.48.1, which is from before reexports were introduced. This means that prelude items are not public in those tests, causing asserts in this PR to fail. #6729 will update the sway-lsp tests to use the latest version of std, at which point the CI checks of this PR ought to pass.

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.

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 (eb1aedc) with master (d46f08a)

Summary

✅ 22 untouched benchmarks

@jjcnn jjcnn temporarily deployed to fuel-sway-bot March 2, 2025 19:13 — with GitHub Actions Inactive
@jjcnn jjcnn temporarily deployed to fuel-sway-bot March 2, 2025 20:09 — with GitHub Actions Inactive
@jjcnn jjcnn marked this pull request as ready for review March 2, 2025 20:28
@jjcnn jjcnn requested a review from a team as a code owner March 2, 2025 20:28
@jjcnn jjcnn temporarily deployed to fuel-sway-bot March 3, 2025 20:34 — with GitHub Actions Inactive
@jjcnn jjcnn temporarily deployed to fuel-sway-bot March 3, 2025 20:54 — with GitHub Actions Inactive
@jjcnn jjcnn temporarily deployed to fuel-sway-bot March 3, 2025 22:19 — with GitHub Actions Inactive
@jjcnn jjcnn temporarily deployed to fuel-sway-bot March 5, 2025 15:23 — with GitHub Actions Inactive
@jjcnn jjcnn temporarily deployed to fuel-sway-bot March 6, 2025 09:38 — with GitHub Actions Inactive
@jjcnn jjcnn temporarily deployed to fuel-sway-bot March 6, 2025 11:21 — with GitHub Actions Inactive
@jjcnn jjcnn added the blocked label Mar 6, 2025
@jjcnn jjcnn temporarily deployed to fuel-sway-bot March 6, 2025 11:59 — with GitHub Actions Inactive
@jjcnn jjcnn temporarily deployed to fuel-sway-bot March 7, 2025 09:59 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Star imports should shadow prelude imports
1 participant