Skip to content

Use commaSeparated helper in more places #14741

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
Mar 23, 2022

Conversation

adampauls
Copy link
Contributor

Pure refactor, but one that will make fixing scala/bug#11900 in dotty easier.

@@ -3203,13 +3200,6 @@ object Parsers {
if !idOK then syntaxError(i"named imports cannot follow wildcard imports")
namedSelector(termIdent())
}
val rest =
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that changes the accepted set of programs since it does not propagate isWildcard to following import selectors.

* @param readFirst If true, assume we have not read the first `part`. Otherwise,
* expect that we have (i.e the next thing to expect is a [[COMMA]]).
*/
def commaSeparated[T](part: () => T, readFirst: Boolean = true): List[T] =
Copy link
Contributor

Choose a reason for hiding this comment

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

Better to avoid boolean parameters. In this case we can do that by having two methods commaSeparated and commaSeparatedRest. The second takes the first node as parameter.

Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

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

This goes in the right direction. I am going to merge and will fix it up later.

@odersky odersky merged commit 6743a27 into scala:main Mar 23, 2022
odersky added a commit to dotty-staging/dotty that referenced this pull request Mar 23, 2022
Do it in Lexer but take into account whether commas are expected
in current region.

Also fixes an issue in scala#14741 regarding import parsing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants