-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Change 'mixed left- and right-associative operators' to Message #1985
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
Conversation
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.
Otherwise LGTM 👍
| : | ||
| + - | ||
| * / % | ||
| (all other special characters) |
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.
Hmm, just reading this with my noob-glasses on, I'd think that letters had the greatest precedence. Then I'd see the sentence on the next line...
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.
You're right. I added a bit more from the language spec.
Would be an idea to provide links to the spec or Stack overflow...
val op2Asso = if (op2LeftAssoc) "which is left-associative" else "which is right-associative" | ||
val msg = s"${hl"`${op1}`"} (${op1Asso}) and ${hl"`${op2}`"} ($op2Asso) have same precedence and may not be mixed" | ||
val explanation = | ||
s"""|The operators ${hl"${op1}"} and ${hl"${op2}"} are used as infix operators in the same expression, |
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.
why not use the hl
interpolator? You still have to interpolate values for them to be highlighted. If there is some interpolated part of the message that gets highlighted incorrectly, you can wrap it in NoColor(..)
or some other "color" that you find more suitable.
Anyway, choose the lesser evil - if hl
requires more boilerplate, then of course s
is preferable.
@@ -404,14 +404,13 @@ object Parsers { | |||
|
|||
var opStack: List[OpInfo] = Nil | |||
|
|||
def checkAssoc(offset: Int, op: Name, leftAssoc: Boolean) = | |||
def checkAssoc(offset: Int, op: Name, leftAssoc: Boolean, op2: Name) = |
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.
I'm assuming you want to avoid a larger diff, but it looks weird that op2
is at the end. If you want to refactor that - put it in a second commit and we'll merge both of them unsquished.
* Add `isSyntheticFunction` checks for synthetic functions such as FuntionN for N > 22 and ImplicitFunctionN for N >= 0. * Add `erasedFunctionClass` to get the erased verion of synthetic functions. * Change the semantics of `isFunctionClass` to return true if it is any kind of FunctionN or ImplicitFunctionN.
This was already be done in TreeTraverser but should also be done in TreeMap and TreeAccumulator for ctx.error(..., tree.pos) to not use completely incorrect positions inside inlined trees.
We cannot assume that the untyped rhs of the bind is a `Typed` tree, with extractors it might be an `Apply` node, and in general it might also be a `Parens` node.
Previously we never used the `pos` argument of `checkNoPrivateLeaks` and instead used `sym.pos`, this makes a difference for calls to `avoidPrivateLeaks` coming from `TreeUnpickler` where we should use `tree.pos` instead.
This is necessary if we ever want to get rid of our dependency on scala-compiler
@felixmulder_ Thank you for pointing out my wrong git user as the problem, I was wondering what was going on. |
No worries :)
…On Mon, Feb 20, 2017, 19:36 Enno ***@***.***> wrote:
@felixmulder_ Thank you for pointing out my wrong git user as the problem,
I was wondering what was going on.
Sorry for the extra work this resulted in for you.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#1985 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABdYwfFAxHISYsqzaMDZrlWHrwhVGP74ks5red0xgaJpZM4MCWgn>
.
|
@felixmulder
This becomes a habit. Next syntax error to the Message scheme, with more explanation from the language specs.
Not really sure if
in.name
is the correct name of the second operator in second part ofinfixOps
.