Parser doesn't error on invalid variable interpolation syntax
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 17k
- Forks
- 3.4k
- Avg merge
- 7h 42m
- Merged PRs (30d)
- 26
Description
To reproduce:
.foo {
@fink: #fff;
color: '@{darken(@fink, 50%)}';
}
Current behavior:
Compiles to the following with no errors:
.foo {
color: '@{darken(@fink, 50%)}';
}
The value of .foo's color property is not interpolated with the value of @fink and is instead the exact same string as the input, down to keeping the @{} interpolation syntax.
Expected behavior:
A parse error on line 3, color: '@{darken(@fink, 50%)}';, given that invoking a function within the variable interpolation syntax is invalid.
[!NOTE]
To do what this attempts to do, you must invoke the function separately in a variable and then interpolate that variable:.bar { @fink: #fff; @bink: darken(@fink, 50%); color: '@{bink}'; }
Environment information:
lessversion: v4.3.0nodejsversion: n/aoperating system: n/a
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 behavior using the linked Less playground and the provided interpolation example. Trace how the parser handles function calls inside variable interpolation; done means the invalid syntax raises a parse error on line 3 while the separately assigned variable example continues to compile correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100