Variable alias breaks unrelated detached rulesets call
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 17k
- Forks
- 3.4k
- Avg merge
- 7h 42m
- Merged PRs (30d)
- 26
Description
I have a piece of code that comes down to the following:
@blue: #007bff;
// @primary: @blue; // Breaks if this line is uncommented
.unlock(@colors, @rules) {
@rules();
}
.positive(@colors) {
fg: @colors[dark];
bg: @colors[light];
}
@fg: { color: @colors[fg]; };
h1 {
@colors: { light: white; dark: black; };
@positive: .positive(@colors);
.unlock(@positive, @fg);
}
Without the @primary definition it works as expected. However when @primary is uncommented I get the following error:
SyntaxError: property "fg" not found in ...:
23 @positive: .positive(@colors);
24 .unlock(@positive, @fg);
25 }
First two lines and the rest of the code are seemingly unrelated to each other, yet these first two lines somehow break the rest of it.
Checked with 4.1.2 (earlier versions have the same issue, at least as early as 3.12.2).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the supplied detached-ruleset example with Less 4.1.2, then trace how the @primary alias affects variable lookup and detached ruleset calls. Add a regression test covering both versions of the example and verify that defining @primary no longer causes the unrelated property "fg" error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, javascript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100