mirror of https://github.com/sveltejs/svelte
fix: error if `{:else}` is followed by another `{:else}` or `{:else if ...}` (#18900)
Fixes #18202pull/18889/merge
parent
179f66b297
commit
fe4fb460b1
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: error if `{:else}` is followed by another `{:else}` or `{:else if ...}`
|
||||
@ -0,0 +1,9 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
error: {
|
||||
code: 'block_duplicate_clause',
|
||||
message: '{:else} cannot appear more than once within a block',
|
||||
position: [42, 42]
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,7 @@
|
||||
{#each items as item}
|
||||
{item}
|
||||
{:else}
|
||||
A
|
||||
{:else}
|
||||
B
|
||||
{/each}
|
||||
@ -0,0 +1,9 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
error: {
|
||||
code: 'block_duplicate_clause',
|
||||
message: '{:else} cannot appear more than once within a block',
|
||||
position: [23, 23]
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,7 @@
|
||||
{#if a}
|
||||
A
|
||||
{:else}
|
||||
B
|
||||
{:else if b}
|
||||
C
|
||||
{/if}
|
||||
Loading…
Reference in new issue