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

Fix module ancestor check for imports #6671

Merged
merged 3 commits into from
Oct 24, 2024
Merged

Conversation

jjcnn
Copy link
Contributor

@jjcnn jjcnn commented Oct 23, 2024

Description

When importing items we allow imports from ancestor modules, even if the ancestor module is declared as private.

The code that performs this check was moved from module.rs to root.rs as part of #5697. During this move the current module path (i.e., the path of the destination of the import) was mistakenly replaced with the module path of the root module of the destination module. Since root modules do not have ancestors this meant that no source module was ever considered an ancestor of the destination module.

This PR fixes this problem, and adds an abscure test case that shows the issue.

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 requested a review from a team as a code owner October 23, 2024 23:05
@jjcnn jjcnn requested a review from tritao October 23, 2024 23:05
Copy link

codspeed-hq bot commented Oct 23, 2024

CodSpeed Performance Report

Merging #6671 will not alter performance

Comparing jjcnn/fix-import-ancestor-check (db441a7) with master (cc842e3)

Summary

✅ 22 untouched benchmarks

@IGI-111 IGI-111 requested a review from a team October 24, 2024 02:38
@IGI-111 IGI-111 merged commit a110a95 into master Oct 24, 2024
40 checks passed
@IGI-111 IGI-111 deleted the jjcnn/fix-import-ancestor-check branch October 24, 2024 08:03
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