-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Guard expressions regression in 2.6.0 #2798
Comments
It's most likely because of #2763 (it seems that this kind of expressions is not covered by tests unfortunately). |
A minimal examples to reproduce: x when ((3) < 4) {
y: z;
}
x when ((3) + 4) {
y: z;
}
etc. |
I will have a look at this, next week at latest. Adding some new tests might be a good idea too. |
I'm trying to fix this too (not sure if I'll be capable to do this earlier though - from what I can see so far, we'll definitely need to consider to switch asap from |
You mean not require parenthesis around |
Yes, but not only. It's actually more about requiring outer parens after
|
I recall that |
And it's the parser that has to test for |
@seven-phases-max Cant we just assume that what follows |
Interestingly, these works:
It seems like it specifically does not allow parenthesis around left side. |
We can. But then someone writes something like: html when true,
body {
font-size: 16px
} and the compiler interprets it as html when true, false {
font-size: 16px;
} thus silently throwing
or
|
Yes, I suppose this is because when we have the first inner parens in And the reverted expression works simply because the parser instantly goes down to |
Well sure, but they've written something explicitly unsupported, and thus has unexpected behavior. I don't see the need to force parentheses here. A comma after
If Less is letting those through, that's a bug. |
(at #2798 (comment) the discussion starts to be about "the planned behaviour", i.e. #2807). |
@seven-phases-max I saw you talking about required parentheses, but in your example you were talking about |
That is:
|
It depends on what we're about. If it's about the current behaviour then there's no |
I don't see how. o_O Any comma after a |
It's not even true for the current behaviour. And especially it doesn't have to be for the planned one. |
Then that's a bug. |
@matthew-dean @seven-phases-max I think that comma after when inside ruleset is a bug, but different one then this one. It might even be harder to fix. |
@matthew-dean @SomMeri |
@seven-phases-max By a bug, I mean that it's weird (unexpected) that a mixin can have a comma-guard and a selector can't. That said, per: #2807 (comment), let's get rid of the comma soon. |
I considered it a bug for the same reason as @matthew-dean - because it is different then in mixin. I agree with deprecating comma for 3.0. |
I guess you both are missing that |
The bug would be that If there's consensus, though, we could mark that bug as "wontfix" until the comma is deprecated / removed. The docs don't yet mention the "or" keyword though. |
@matthew-dean I created new issue for that in docs #396. Btw, it is great that less.js is getting more active lately 👍 . |
Guard expressions regression in 2.6.0 (#2798)
will error with:
The text was updated successfully, but these errors were encountered: