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:
Severity
Unknown.
Additional context
Mentioned in Discord here.
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.
Most helpful comment
Thanks for the quick PR @tanhauhau ! 馃殌 Fix released in 3.20.1.