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

Allow re-export of sway modules via pub use. #3113

Open
nfurfaro opened this issue Oct 24, 2022 · 1 comment · May be fixed by #6116
Open

Allow re-export of sway modules via pub use. #3113

nfurfaro opened this issue Oct 24, 2022 · 1 comment · May be fixed by #6116
Assignees
Labels
compiler General compiler. Should eventually become more specific as the issue is triaged enhancement New feature or request language feature Core language features visible to end users

Comments

@nfurfaro
Copy link
Contributor

This currently fails with:
image

@nfurfaro nfurfaro added enhancement New feature or request compiler General compiler. Should eventually become more specific as the issue is triaged labels Oct 24, 2022
@mohammadfawaz mohammadfawaz added the language feature Core language features visible to end users label Oct 24, 2022
@nfurfaro
Copy link
Contributor Author

Just bumping this.

@IGI-111 IGI-111 self-assigned this May 8, 2023
IGI-111 added a commit that referenced this issue Mar 8, 2024
## Description

This PR contains the final bit of refactoring before I start fixing the
import problems mentioned in #5498.

The semantics of imports has so far been implemented in the `Module`
struct, and has assumed that the destination path of an import was
relative to `self`. In particular, this allows imports to any submodule
of the current module.

However, whenever that logic was triggered by the compiler the
destination path was always absolute. The only reason this worked was
that the logic was only ever triggered on the root module.

To reflect this behavior I have therefore moved the import semantics to
the `Root` struct, and made it clear in the comments that the paths are
assumed to be absolute.

This also reflects the fact that once the module structure has been
populated with the imported entities we don't actually need the import
logic anymore, so it shouldn't be located in the `Module` struct. (Name
resolution should obviously stay in the `Module` struct, so that logic
has not been moved).

I have left a couple of TODOs in the code to remind myself where I need
to make changes when I start implementing `pub use` (see #3113 ).

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.

---------

Co-authored-by: IGI-111 <[email protected]>
@jjcnn jjcnn linked a pull request Jun 12, 2024 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler General compiler. Should eventually become more specific as the issue is triaged enhancement New feature or request language feature Core language features visible to end users
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants