-
Notifications
You must be signed in to change notification settings - Fork 323
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
Conversation
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. |
There was a problem hiding this comment.
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.
@@ -1,108 +1,3 @@ | |||
import project.Any.Any |
There was a problem hiding this comment.
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!
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:
but can be replaced with simple:
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:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.