You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@RealDolos Because in parens-division mode (the 4.0 Less default), you're trying to add 1 + a CSS expression 1 / 1. The division won't divide; it will be output as is, so you can't add 1 to it.
@RealDolos Now, an argument could be made that just the 1 + 1 should add together in that case, but unfortunately that's not the way it's parsed. As it is, division is parsed as a division operation, even if it's not performed, so when it's not performed, it can't be part of other operations, and should throw an error.
Still, "Operation on an invalid type" is a bit of a shit error message
Please be kind. That's the error message thrown on other types if you attempt operations (with like a keyword for example). I only meant it should be throwing a proper error, and that's the current error message for operations.
Activity
matthew-dean commentedon Jan 7, 2021
That can't be your only line in the file? Do you have more context?
laino commentedon Jan 10, 2021
Nope. That's the only line. It takes just that.
laino commentedon Jan 10, 2021
Here's a video ;)
laino commentedon Jan 10, 2021
Actually the
* 4isn't even necessary.Just this is enough:
RealDolos commentedon Jan 10, 2021
oopsie whoopsie.
otheris{operand: "/", ... }still when this code is called:https://github.com/less/less.js/blob/master/packages/less/src/less/tree/dimension.js#L73
matthew-dean commentedon Jan 13, 2021
This is a bug that just got introduced?
laino commentedon Jan 13, 2021
It's a bug that has existed at least since the
4.0.0release and is still present in4.1.0.It's probably related to the "Parens-division now the default math setting" change.
Fixes less#3586
matthew-dean commentedon Jan 13, 2021
So it looks like for the above code, Less should be throwing
'Operation on an invalid type'. See: #3589RealDolos commentedon Jan 15, 2021
Why?
matthew-dean commentedon Jan 15, 2021
@RealDolos Because in
parens-divisionmode (the 4.0 Less default), you're trying to add1 +a CSS expression1 / 1. The division won't divide; it will be output as is, so you can't add 1 to it.matthew-dean commentedon Jan 15, 2021
@RealDolos Now, an argument could be made that just the
1 + 1should add together in that case, but unfortunately that's not the way it's parsed. As it is, division is parsed as a division operation, even if it's not performed, so when it's not performed, it can't be part of other operations, and should throw an error.RealDolos commentedon Jan 15, 2021
Adding
1 + 1would be surprising behavior I suppose.Still, "Operation on an invalid type" is a bit of a shit error message
matthew-dean commentedon Jan 15, 2021
@RealDolos
Please be kind. That's the error message thrown on other types if you attempt operations (with like a keyword for example). I only meant it should be throwing a proper error, and that's the current error message for operations.
Fixes less#3586 (less#3589)