lightningcss
lightningcss copied to clipboard
Invalid calc() crashes
trafficstars
This invalid calc
div {
height: calc(100% - 2 (2 * var(--card-margin)));
}
crashes in playground with:
/* ERROR: Unreachable code should not be executed (evaluating 'n(i.id,o)') */
and in node with:
thread '<unnamed>' panicked at 'internal error: entered unreachable code', src/values/percentage.rs:81:12
That is only number crashes, anything else instead of 2 will pass. Stylelint passes on that calc() and this error in syntax crashes whole css workflow without no clear hint.
I also received this error with this example code
.lighten-by-25 {
background: oklch(from blue calc(l + 25) c h);
}
taken directly from this chrome developer page