Skip to content

Update imports.md #15321

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

Merged
merged 1 commit into from
Jun 1, 2022
Merged

Update imports.md #15321

merged 1 commit into from
Jun 1, 2022

Conversation

manojo
Copy link
Contributor

@manojo manojo commented May 30, 2022

Without the additional braces making the SimpleRef. optional in ImportExpr, an expression such as import java as j wouldn't technically be accepted by the grammar specification.

Co-authored-by: @keynmol

Without the additional braces making the `SimpleRef.` optional in `ImportExpr`, an expression such as `import java as j` wouldn't technically be accepted by the grammar specification.

Co-authored-by: keynmol
Copy link
Contributor

@julienrf julienrf left a comment

Choose a reason for hiding this comment

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

Thank you @manojo for the PR! I think if we change it here, we should also change it in the syntax.md file (https://github.com/lampepfl/dotty/blob/main/docs/_docs/reference/syntax.md) and in https://github.com/lampepfl/dotty/blob/main/docs/_docs/internals/syntax.md.

But before we go further, I would like @odersky to approve this change.

@julienrf julienrf requested a review from odersky May 31, 2022 08:07
@odersky
Copy link
Contributor

odersky commented Jun 1, 2022

No, this case is already covered by the second production for ImportExpr. The proposed change is not what we want or implement.

                    |  SimpleRef ‘as’ id

@odersky odersky closed this Jun 1, 2022
@@ -48,7 +48,7 @@ are offered under settings `-source 3.1-migration -rewrite`.

```
Import ::= ‘import’ ImportExpr {‘,’ ImportExpr}
ImportExpr ::= SimpleRef {‘.’ id} ‘.’ ImportSpec
ImportExpr ::= { SimpleRef {‘.’ id} ‘.’ } ImportSpec
Copy link
Contributor Author

@manojo manojo Jun 1, 2022

Choose a reason for hiding this comment

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

Suggested change
ImportExpr ::= { SimpleRef {‘.’ id} ‘.’ } ImportSpec
ImportExpr ::= SimpleRef {‘.’ id} ‘.’ ImportSpec
| SimpleRef `as` id

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that's the right fix.

@manojo
Copy link
Contributor Author

manojo commented Jun 1, 2022

@odersky thank you for the message. It looks like the reference syntax is indeed correct, but the imports.md file does not currently have the second production for ImportExpr. @julienrf I've tried to add the second production as a suggestion to this PR. Let me know if this makes sense :-)

@julienrf
Copy link
Contributor

julienrf commented Jun 1, 2022

Yes, thank you Mano it makes sense! Could you please apply the changes (I can’t do it from GitHub) and re-open the PR?

@odersky odersky reopened this Jun 1, 2022
@odersky
Copy link
Contributor

odersky commented Jun 1, 2022

Thanks for the fix, Mano!

@odersky odersky merged commit 9f12e76 into scala:language-reference-stable Jun 1, 2022
manojo added a commit to manojo/dotty that referenced this pull request Jun 1, 2022
Looks like the change in scala#15321 remained a [suggestion](scala#15321 (comment)) and didn't get merged correctly, unfortunately.
@manojo manojo deleted the patch-1 branch June 1, 2022 15:59
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