Skip to content

Svelte 5: Compiler creates unused variables #9556

@KevsRepos

Description

@KevsRepos

Describe the bug

You can "confuse" the compiler by creating indentifiers that the compiler wanted to create itself. This causing the compiler to create more variables than necessary. Notice in the repl that there is count_const_1 and count_const_2, even though count_const_2 is never used.

Reproduction

https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAA22OwQoDIQxEf0Vy3WJ7FrfQ76ilFDcLghtF49Ky-O_V7aE99JaZN5Nkg9l5zKCuG9BjQVBwiREOwK_YRV7RMzadQ0m2Ozrb5CILG4jxyaOBJUzFo4GzIcMeOyrEYhQnQ_r4iXdG-jvznhmGbv-U7m1r_lfddlyllO2XdtDNDidQnArWW30DTRUNSMYAAAA=

Logs

No response

System Info

System:
    OS: Linux 6.5 Pop!_OS 22.04 LTS
    CPU: (12) x64 12th Gen Intel(R) Core(TM) i5-1235U
    Memory: 4.49 GB / 15.32 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 19.3.0 - ~/.nvm/versions/node/v19.3.0/bin/node
    npm: 9.2.0 - ~/.nvm/versions/node/v19.3.0/bin/npm
  Browsers:
    Chrome: 118.0.5993.70
    Firefox: 118.0.2

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions