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

Malformed generated code in a situation I can't describe #3595

Closed
Conduitry opened this issue Sep 19, 2019 · 3 comments · Fixed by #3749
Closed

Malformed generated code in a situation I can't describe #3595

Conduitry opened this issue Sep 19, 2019 · 3 comments · Fixed by #3749
Labels

Comments

@Conduitry
Copy link
Member

Describe the bug
For

{#if $foo}
{:else}
	{#if bar()}
		<Baz/>
	{/if}
{/if}

or alternatively

{#if $foo}
{:else if bar()}
	<Baz/>
{/if}

Svelte generates code like if ((show_if == null) || ) show_if = !!(bar()).

To Reproduce
Compile the above, and look at the invalid code that's generated.

Expected behavior
Presumably the || part just shouldn't be there, but I haven't checked whether that code would do what is expected.

Information about your Svelte project:
Svelte 3.12.1

Severity
Medium-low-ish, probably. This seems to occur in a fairly specific situation.

Additional context
Quite possibly this will be fixed by #3539, but I wanted a record of this repro anyway.

@Conduitry Conduitry added the bug label Sep 19, 2019
@Conduitry
Copy link
Member Author

An equivalent bug seems to be currently present in that branch. I'm getting an error about reducing an empty array here, but at least a compile-time exception is better than generating invalid code.

@ghost
Copy link

ghost commented Sep 19, 2019

@Conduitry, possibly also related to #3588?

@joshleblanc
Copy link

@dkondrad this issue also appeared in 3.9.1, it compiles fine in prior versions.

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.

2 participants