lightningcss icon indicating copy to clipboard operation
lightningcss copied to clipboard

Invalid calc() crashes

Open atirip opened this issue 2 years ago • 1 comments
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.

atirip avatar Nov 14 '23 10:11 atirip

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

tipiirai avatar Dec 24 '23 06:12 tipiirai