sveltejs / svelte

web development for the rest of us
https://svelte.dev
MIT License
80.09k stars 4.26k forks source link

sibling selectors involving `{#key ...}`/`{@render ...}` are incorrectly marked as unused #14399

Open Rich-Harris opened 18 hours ago

Rich-Harris commented 18 hours ago

Describe the bug

Because of this line... https://github.com/sveltejs/svelte/blob/dd9abea2a1059cbead398c5578bfd07a3c3ddd69/packages/svelte/src/compiler/phases/2-analyze/css/css-prune.js#L955 ...and this line... https://github.com/sveltejs/svelte/blob/dd9abea2a1059cbead398c5578bfd07a3c3ddd69/packages/svelte/src/compiler/phases/2-analyze/css/css-prune.js#L955 ...we incorrectly prune sibling selectors when things other than if/each/await blocks are involved. Discovered while working on #14395

Reproduction

Logs

No response

System Info

latest

Severity

annoyance

Rich-Harris commented 16 hours ago

here's another case that fails

Rich-Harris commented 1 hour ago

and another

Rich-Harris commented 1 hour ago

yet another