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

Export works without import #9683

Merged
merged 14 commits into from
Apr 12, 2024
Merged

Export works without import #9683

merged 14 commits into from
Apr 12, 2024

Conversation

Akirathan
Copy link
Member

@Akirathan Akirathan commented Apr 11, 2024

Closes #9562

Pull Request Description

This PR enables exporting a symbol by FQN without the need to import it first. As a consequence, the following do-repeat-yourself pattern will no longer be needed in standard libraries main modules:

import project.Data.Vector.Vector
export project.Data.Vector.Vector

but can be replaced with simple:

export project.Data.Vector.Vector

Important Notes

ImportResolver traverses also the export statements, and checks if there is a corresponding import statement for it. If not, it tries to insert a synthetic import statement and resolve it.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@Akirathan Akirathan self-assigned this Apr 11, 2024
Comment on lines +49 to +51
Currently, the `project` keyword works only in import and export statements.
Note that it is possible to export a symbol from the current project with the
`project` keyword without first importing it.
Copy link
Member Author

Choose a reason for hiding this comment

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

Changes in this PR are mentioned just in this paragraph. The rest of the diff to this documentation file is just an attempt to update the specification to correspond to the current functionality.

@Akirathan Akirathan marked this pull request as ready for review April 11, 2024 16:44
@Akirathan Akirathan added CI: No changelog needed Do not require a changelog entry for this PR. CI: Clean build required CI runners will be cleaned before and after this PR is built. labels Apr 11, 2024
@@ -1,108 +1,3 @@
import project.Any.Any
Copy link
Member

Choose a reason for hiding this comment

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

This is a very nice change!

@Akirathan Akirathan merged commit 4dc7992 into develop Apr 12, 2024
35 of 38 checks passed
@Akirathan Akirathan deleted the wip/akirathan/9562-fqn-exports branch April 12, 2024 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Clean build required CI runners will be cleaned before and after this PR is built. CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export FQN without any imports
4 participants