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

better positioning of _* not last argument error #1184

Merged
merged 1 commit into from
Mar 22, 2016
Merged

better positioning of _* not last argument error #1184

merged 1 commit into from
Mar 22, 2016

Conversation

liufengyun
Copy link
Contributor

The error should be at the beginning of the underscore _,
not the next token after the star *, which is the default.

Before:

tests/neg/i1059.scala:5: error: `_*' can be used only for last argument
    case _ : _*                    =>   0
                                   ^

After:

tests/neg/i1059.scala:5: error: `_*' can be used only for last argument
    case _ : _*                    =>   0
             ^                       

@@ -234,7 +234,7 @@ object Parsers {
syntaxErrorOrIncomplete(expectedMsg(token))
}
if (in.token == token) in.nextToken()
in.offset
offset
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change is dubious, but it seems to be what's in the mind of the original author. Otherwise, there's no need to define the variable offset.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, good catch. It should be offset. Can you add to the doc comment a clause which says "@return The offset at the start of the token to accept"? Thanks!

The error should be at the beginning of the underscore `_`,
not the next token after the star `*`, which is the default.
@liufengyun
Copy link
Contributor Author

I've updated the commit addressing the concerns above. Now the tests pass.

@odersky
Copy link
Contributor

odersky commented Mar 21, 2016

All LGTM now.

odersky added a commit that referenced this pull request Mar 22, 2016
better positioning of `_*` not last argument error
@odersky odersky merged commit 552a56a into scala:master Mar 22, 2016
@liufengyun liufengyun deleted the error-pos branch April 6, 2016 08:02
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.

2 participants