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

less parse about inconsistent operation performance #3692

Closed
zhusjfaker opened this issue Feb 18, 2022 · 2 comments
Closed

less parse about inconsistent operation performance #3692

zhusjfaker opened this issue Feb 18, 2022 · 2 comments
Assignees
Labels

Comments

@zhusjfaker
Copy link

To reproduce:

// parse ok

@c:20px + 20px * 2px;

.d {
    font-size: @c;
}

// parse ok

@c:20px + (20px * 2px);

.d {
    font-size: @c;
}

// parse fail

@c:20px + 20px / 2px;

.d {
    font-size: @c;
}

// parse ok

@c:20px + (20px / 2px);

.d {
    font-size: @c;
}

Current behavior:

less.js the operation of variables is inconsistent in multiplication and division

Expected behavior:

consistent behavior

Environment information:

  • less version: 3.13.0
  • nodejs version: 16.13
  • operating system: darwin

please do not forcibly close issue

@lumburr
Copy link
Contributor

lumburr commented Mar 30, 2022

I'm trying to fix this issue, there have been many discussions about math rules in less. This is an issue of historical discussions #1880
I found in the documentation the new operation description in less 4
https://github.com/less/less-docs/blob/master/content/usage/less-options.md
屏幕截图 2022-03-30 204547
Another issue also verified my view
#3586
My understanding is that, we should throw error in there 7 situations.

// parse fail
@c:20px + 20px / 2px; 

// parse fail
@c:20px - 20px / 2px; 

// parse fail
@c:20px / 20px / 2px; 

// parse fail
@c:20px * 20px / 2px; 

// parse fail
@c:20px / 20px + 2px; 

// parse fail
@c:20px /20px - 2px; 

// parse fail
@c:20px / 20px * 2px; 

I'm not sure my understanding is correct. I need your advice to modify pr.
@matthew-dean @iChenLei

@matthew-dean
Copy link
Member

matthew-dean commented Apr 1, 2023

Yes, the failures are expected in the current Less math mode. See: https://github.com/less/less-docs/blob/master/content/usage/less-options.md#math

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants