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

Fix object names as unary operators #2105

Merged
merged 1 commit into from
Aug 3, 2020

Conversation

kpbochenek
Copy link
Collaborator

Fixes #2095

When we encounter token looking like 'unary operator' we always parse it this way.
But as in example in #2095 it can be also an ident(name of object/class etc).

Instead of throwing exception when we cannot parse it as unary operator we can try and assume '-' is ident and parse it this way.

@kpbochenek kpbochenek force-pushed the fix-minus-object-name branch 3 times, most recently from e2a626d to a7e9837 Compare July 30, 2020 15:39
Copy link
Collaborator

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

LGTM!

else
atPos(op, auto)(Term.ApplyUnary(op, simpleExpr(allowRepeated = true)))
else {
simpleExpr0(allowRepeated = true) match {
Copy link
Contributor

Choose a reason for hiding this comment

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

if we hadn't had to build it for 2.11, fold would have been ideal here, although our usage is also equivalent to .map(...).getOrElse(...).

@kpbochenek kpbochenek merged commit 74a17e3 into scalameta:master Aug 3, 2020
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.

Parse error with a minus (dash) token
3 participants