Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler error in 3.20.0 with certain slot usage #4562

Closed
Conduitry opened this issue Mar 16, 2020 · 5 comments · Fixed by #4564
Closed

Compiler error in 3.20.0 with certain slot usage #4562

Conduitry opened this issue Mar 16, 2020 · 5 comments · Fixed by #4564
Labels

Comments

@Conduitry
Copy link
Member

Conduitry commented Mar 16, 2020

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.

@Conduitry Conduitry added the bug label Mar 16, 2020
@jakobrosenberg
Copy link

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

tanhauhau added a commit to tanhauhau/svelte that referenced this issue Mar 16, 2020
@tanhauhau
Copy link
Member

tanhauhau commented Mar 16, 2020

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

@Conduitry
Copy link
Member Author

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

@jakobrosenberg
Copy link

@Conduitry @tanhauhau

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

@Conduitry
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants