Svelte: Compiler error in 3.20.0 with certain slot usage

Created on 16 Mar 2020  路  5Comments  路  Source: sveltejs/svelte

Describe the bug
As of 3.20.0, the compiler is now throwing an exception when compiling certain slot usages.

Logs
Compile time exception: Variable 't' already initialised with a different value

To Reproduce

<slot>
    <div title={foo}>foo</div>
    <div>bar</div>
</slot>

Expected behavior
This compiles without an exception.

Stacktraces


Stack trace

Error: Variable 't' already initialised with a different value
    at Block$1.add_variable (.../src/compiler/compile/render_dom/Block.ts:210:10)
    at Block$1.add_element (.../src/compiler/compile/render_dom/Block.ts:177:8)
    at TextWrapper.render (.../src/compiler/compile/render_dom/wrappers/Text.ts:47:9)
    at FragmentWrapper.render (.../src/compiler/compile/render_dom/wrappers/Fragment.ts:147:18)
    at SlotWrapper.render (.../src/compiler/compile/render_dom/wrappers/Slot.ts:117:18)        
    at FragmentWrapper.render (.../src/compiler/compile/render_dom/wrappers/Fragment.ts:147:18)
    at new Renderer (.../src/compiler/compile/render_dom/Renderer.ts:101:17)
    at dom (.../src/compiler/compile/render_dom/index.ts:17:19)
    at Object.render_dom [as compile] (.../src/compiler/compile/index.ts:97:6)

Information about your Svelte project:

  • Svelte 3.20.0
  • REPL

Severity
Unknown.

Additional context
Mentioned in Discord here.

bug

Most helpful comment

Thanks for the quick PR @tanhauhau ! 馃殌 Fix released in 3.20.1.

All 5 comments

I spent the day troubleshooting why my apps won't start.

Any slot where the first element is a <!-- comment --> halts the build.

<slot>foobar<!-- placeholder--></slot> works
<slot> <!-- placeholder--></slot> works
<slot></slot> works
<slot/> works
<slot><!-- placeholder--></slot> doesn't work
<slot><!-- placeholder--> </slot> doesn't work
<slot><!-- placeholder--> foobar </slot> doesn'tworks

thank you for figuring out the bug, sorry for the inconvenient cost

Thanks for the quick PR @tanhauhau ! 馃殌 Fix released in 3.20.1.

@Conduitry @tanhauhau

The bug isn't fixed in 3.20.1. At the moment I have to fix it by using 3.19.2.

The bug in my original comment in this ticket is fixed. If you have a repro for another related but different bug, please open an issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matt3224 picture matt3224  路  3Comments

1u0n picture 1u0n  路  3Comments

Rich-Harris picture Rich-Harris  路  3Comments

plumpNation picture plumpNation  路  3Comments

AntoninBeaufort picture AntoninBeaufort  路  3Comments