AmazonScience/SWE-PolyBench huggingface dataset:
Repository: sveltejs/svelte (JavaScript)
Date: 2020-05-03 20:09:36+00:00
Task type: Bug Fix

Issue:
img-redundant-alt warning bug (Breaking)
**Describe the bug**
`alt` attributes with expressions on image elements returns `null` for static value, but new commit for `img-redundant-alt` warning checks it as a string. 

https://github.com/sveltejs/svelte/commit/153b128fe28a3283b684fccb051deb66152a6d46#diff-8e6b4a7e9c9ba91db066af615305f5f4R491

This breaks whole build process.

**Logs**
Build log:
```
[!] (plugin svelte) TypeError: Cannot read property 'match' of null
 src/components/SourcesBar.svelte
 TypeError: Cannot read property 'match' of null
     at Element$1.validate_special_cases (node_modules/svelte/src/compiler/compile/nodes/Element.ts:491:19)
     at Element$1.validate (node_modules/svelte/src/compiler/compile/nodes/Element.ts:275:8)
     at new Element$1 (node_modules/svelte/src/compiler/compile/nodes/Element.ts:220:8)
     ...
```

**To Reproduce**
https://svelte.dev/repl/1b24eb90a2bf4b1fbcbc1250b80aecbb?version=3.22.0

**Expected behavior**
Skip check if alt value is not string or falsy. (`null` in this case)

**Information about your Svelte project:**

- Tested on e.x. OS X 10.14, Ubuntu Linux 19.10

- Svelte version: 3.22.0 

- Whether your project uses Webpack or Rollup: Rollup

**Severity**
BREAKING!

**Additional context**
I'm sending PR soon!



Issue discussion:

Solution patch:
diff --git a/src/compiler/compile/nodes/Element.ts b/src/compiler/compile/nodes/Element.ts
--- a/src/compiler/compile/nodes/Element.ts
+++ b/src/compiler/compile/nodes/Element.ts
@@ -438,7 +438,7 @@ export default class Element extends Node {
 
 			if (href_attribute) {
 				const href_value = href_attribute.get_static_value();
-				
+
 				if (href_value === '' || href_value === '#' || /^\W*javascript:/i.test(href_value)) {
 					component.warn(href_attribute, {
 						code: `a11y-invalid-attribute`,
@@ -484,11 +484,11 @@ export default class Element extends Node {
 			const aria_hidden_attribute = attribute_map.get('aria-hidden');
 
 			const aria_hidden_exist = aria_hidden_attribute && aria_hidden_attribute.get_static_value();
-			
+
 			if (alt_attribute && !aria_hidden_exist) {
 				const alt_value = alt_attribute.get_static_value();
 
-				if (alt_value.match(/\b(image|picture|photo)\b/i)) {
+				if (alt_value && alt_value.match(/\b(image|picture|photo)\b/i)) {
 					component.warn(this, {
 						code: `a11y-img-redundant-alt`,
 						message: `A11y: Screenreaders already announce <img> elements as an image.`


Test patch:
diff --git a/test/validator/samples/a11y-img-redundant-alt/input.svelte b/test/validator/samples/a11y-img-redundant-alt/input.svelte
--- a/test/validator/samples/a11y-img-redundant-alt/input.svelte
+++ b/test/validator/samples/a11y-img-redundant-alt/input.svelte
@@ -4,4 +4,5 @@
 <img src="bar" alt="Image of me at a bar!" />
 <img src="foo" alt="Picture of baz fixing a bug." />
 <img src="bar" alt="Plant doing photosynthesis in the afternoon" />
-<img src="foo" alt="Picturesque food" />
\ No newline at end of file
+<img src="foo" alt="Picturesque food" />
+<img src="baz" alt={'baz'} />
Repository: sveltejs/svelte (JavaScript)
Date: 2020-05-03 20:54:22+00:00
Task type: Bug Fix

Issue:
For input numbers we should use null instead undefined in toNumber
If you return undefined it became the problem for some situations like this (we can't set undefined back):
https://svelte.technology/repl?version=2.30.1&gist=4728f0fd73979c92e7c07ec0a7eebb94

by the standard, the "number input" can contain numbers or empty and empty here is an empty string or null. 
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number


Issue discussion:
I don't know what the problem was supposed to have been when this issue was opened (and I also don't know what version it was against. there is no 2.30.1), but in the latest v2 I don't see anything in the console https://v2.svelte.dev/repl?version=2.16.1&gist=4728f0fd73979c92e7c07ec0a7eebb94
@Conduitry 
this problem still exists, I can reproduce it even on v3 https://svelte.dev/repl/922cb0532c56400a94d95e8d4536e322?version=3.8.0

please reopen. The main idea is you can't return undefined from "input number" because you can't set it back, it's just not valid by the standard. 
Returning `undefined` for an empty number input field happened in #606 as a solution for #584. I don't know what returning `null` instead would do.
I see, anyway return `null` also should fix #584 and will be consistent with browsers standards. 
(and fix browsers warnings)
Warnings like this:
```
VM67:304 The specified value "undefined" is not a valid number. The value must match to the following regular expression: -?(\d+|\d+\.\d+|\.\d+)([eE][-+]?\d+)?
```
@Conduitry did you see the same warning? 
I see the warning in 3.20.1 - note that the warning doesn't appear in the Svelte console, but the browser console.

Solution patch:
diff --git a/src/runtime/internal/dom.ts b/src/runtime/internal/dom.ts
--- a/src/runtime/internal/dom.ts
+++ b/src/runtime/internal/dom.ts
@@ -133,7 +133,7 @@ export function get_binding_group_value(group) {
 }
 
 export function to_number(value) {
-	return value === '' ? undefined : +value;
+	return value === '' ? null : +value;
 }
 
 export function time_ranges_to_array(ranges) {


Test patch:
diff --git a/test/runtime/samples/binding-input-number/_config.js b/test/runtime/samples/binding-input-number/_config.js
--- a/test/runtime/samples/binding-input-number/_config.js
+++ b/test/runtime/samples/binding-input-number/_config.js
@@ -35,14 +35,14 @@ export default {
 			<p>number 44</p>
 		`);
 
-		// empty string should be treated as undefined
+		// empty string should be treated as null
 		input.value = '';
 		await input.dispatchEvent(event);
 
-		assert.equal(component.count, undefined);
+		assert.equal(component.count, null);
 		assert.htmlEqual(target.innerHTML, `
 			<input type='number'>
-			<p>undefined undefined</p>
+			<p>object null</p>
 		`);
 	},
 };
Repository: sveltejs/svelte (JavaScript)
Date: 2020-05-04 15:18:32+00:00
Task type: Bug Fix

Issue:
Build fails – TypeError: alt_value.match is not a function
Enter `<img alt>` in a REPL.

Cause: https://github.com/sveltejs/svelte/blob/master/src/compiler/compile/nodes/Element.ts#L491


Issue discussion:

Solution patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # Svelte changelog
 
+## Unreleased
+
+* Fix compiler exception with `a11y-img-redundant-alt` and value-less `alt` attribute ([#4777](https://github.com/sveltejs/svelte/issues/4777))
+
 ## 3.22.1
 
 * Fix compiler exception with `a11y-img-redundant-alt` and dynamic `alt` attribute ([#4770](https://github.com/sveltejs/svelte/issues/4770))
diff --git a/src/compiler/compile/nodes/Element.ts b/src/compiler/compile/nodes/Element.ts
--- a/src/compiler/compile/nodes/Element.ts
+++ b/src/compiler/compile/nodes/Element.ts
@@ -488,7 +488,7 @@ export default class Element extends Node {
 			if (alt_attribute && !aria_hidden_exist) {
 				const alt_value = alt_attribute.get_static_value();
 
-				if (alt_value && alt_value.match(/\b(image|picture|photo)\b/i)) {
+				if (/\b(image|picture|photo)\b/i.test(alt_value)) {
 					component.warn(this, {
 						code: `a11y-img-redundant-alt`,
 						message: `A11y: Screenreaders already announce <img> elements as an image.`


Test patch:
diff --git a/test/validator/samples/a11y-img-redundant-alt/input.svelte b/test/validator/samples/a11y-img-redundant-alt/input.svelte
--- a/test/validator/samples/a11y-img-redundant-alt/input.svelte
+++ b/test/validator/samples/a11y-img-redundant-alt/input.svelte
@@ -6,3 +6,4 @@
 <img src="bar" alt="Plant doing photosynthesis in the afternoon" />
 <img src="foo" alt="Picturesque food" />
 <img src="baz" alt={'baz'} />
+<img src="baz" alt />
Repository: sveltejs/svelte (JavaScript)
Date: 2020-05-09 06:54:44+00:00
Task type: Bug Fix

Issue:
Spread props + bind:group + value
It's very weird behavior!

When I use `spread props`, the attribute `value` is not rendering.

I did a REPL:
https://svelte.dev/repl/73b2780bd1744b189564ffca010c2aec?version=3.22.2

Example (fragment in REPL):

```svelte
<input
  type="radio"
  id="{name}_{idx}"
  {value}
  {...props}
  bind:group={$store[name]}
/>
```
![image](https://user-images.githubusercontent.com/130963/81442266-aaa80680-9149-11ea-9e5e-2639e7493e74.png)

---

Workaround to work:

```svelte
<input
  type="radio"
  id="{name}_{idx}"
  {value}
  {...{...props, value}}
  bind:group={$store[name]}
/>
```

Spread props + bind:group + value
It's very weird behavior!

When I use `spread props`, the attribute `value` is not rendering.

I did a REPL:
https://svelte.dev/repl/73b2780bd1744b189564ffca010c2aec?version=3.22.2

Example (fragment in REPL):

```svelte
<input
  type="radio"
  id="{name}_{idx}"
  {value}
  {...props}
  bind:group={$store[name]}
/>
```
![image](https://user-images.githubusercontent.com/130963/81442266-aaa80680-9149-11ea-9e5e-2639e7493e74.png)

---

Workaround to work:

```svelte
<input
  type="radio"
  id="{name}_{idx}"
  {value}
  {...{...props, value}}
  bind:group={$store[name]}
/>
```



Issue discussion:

Solution patch:
diff --git a/src/runtime/internal/dom.ts b/src/runtime/internal/dom.ts
--- a/src/runtime/internal/dom.ts
+++ b/src/runtime/internal/dom.ts
@@ -98,7 +98,9 @@ export function set_attributes(node: Element & ElementCSSInlineStyle, attributes
 			node.removeAttribute(key);
 		} else if (key === 'style') {
 			node.style.cssText = attributes[key];
-		} else if (key === '__value' || descriptors[key] && descriptors[key].set) {
+		} else if (key === '__value') {
+			(node as any).value = node[key] = attributes[key];
+		} else if (descriptors[key] && descriptors[key].set) {
 			node[key] = attributes[key];
 		} else {
 			attr(node, key, attributes[key]);


Test patch:
diff --git a/test/runtime/samples/spread-element-input-bind-group-with-value-attr/_config.js b/test/runtime/samples/spread-element-input-bind-group-with-value-attr/_config.js
new file mode 100644
--- /dev/null
+++ b/test/runtime/samples/spread-element-input-bind-group-with-value-attr/_config.js
@@ -0,0 +1,15 @@
+export default {
+	props: {
+		props: {
+			'data-foo': 'bar'
+		}
+	},
+
+	html: `<input data-foo="bar" type="radio" value="abc">`,
+
+	async test({ assert, component, target, window }) {
+		const input = target.querySelector('input');
+		assert.equal(input.value, 'abc');
+		assert.equal(input.__value, 'abc');
+	}
+};
diff --git a/test/runtime/samples/spread-element-input-bind-group-with-value-attr/main.svelte b/test/runtime/samples/spread-element-input-bind-group-with-value-attr/main.svelte
new file mode 100644
--- /dev/null
+++ b/test/runtime/samples/spread-element-input-bind-group-with-value-attr/main.svelte
@@ -0,0 +1,6 @@
+<script>
+	export let props;
+	let radioValue;
+</script>
+
+<input type="radio" value="abc" {...props} bind:group={radioValue} />
Repository: sveltejs/svelte (JavaScript)
Date: 2020-05-30 22:07:15+00:00
Task type: Bug Fix

Issue:
Compiler crashes with orphaned :global in CSS
**Describe the bug**

CSS like this causes the Svelte compiler to crash:
```
<style>
  .codemirror-container.flex :global {padding:0}
</style>
```

**To Reproduce**
https://svelte.dev/repl/c0b2792175ab48c0afb84b01b9bfa247?version=3.23.0

**Expected behavior**
Throw an error instead of crashing.

**Severity**

Very minor since it's invalid syntax and nobody would intentionally write this. This happened because I had purgecss in my postcss preprocessor config and I needed to whitelist some classes.



Issue discussion:

Solution patch:
diff --git a/src/compiler/parse/read/style.ts b/src/compiler/parse/read/style.ts
--- a/src/compiler/parse/read/style.ts
+++ b/src/compiler/parse/read/style.ts
@@ -54,6 +54,13 @@ export default function read_style(parser: Parser, start: number, attributes: No
 				}, node.start);
 			}
 
+			if (node.type === 'PseudoClassSelector' && node.name === 'global' && node.children === null) {
+				parser.error({
+					code: `css-syntax-error`,
+					message: `:global() must contain a selector`
+				}, node.loc.start.offset);
+			}
+
 			if (node.loc) {
 				node.start = node.loc.start.offset;
 				node.end = node.loc.end.offset;
@@ -87,4 +94,4 @@ function is_ref_selector(a: any, b: any) { // TODO add CSS node types
 		a.name === 'ref' &&
 		b.type === 'PseudoClassSelector'
 	);
-}
\ No newline at end of file
+}


Test patch:
diff --git a/test/parser/samples/error-css-global-without-selector/error.json b/test/parser/samples/error-css-global-without-selector/error.json
new file mode 100644
--- /dev/null
+++ b/test/parser/samples/error-css-global-without-selector/error.json
@@ -0,0 +1,10 @@
+{
+	"code": "css-syntax-error",
+	"message": ":global() must contain a selector",
+	"start": {
+		"line": 2,
+		"column": 1,
+		"character": 9
+	},
+	"pos": 9
+}
diff --git a/test/parser/samples/error-css-global-without-selector/input.svelte b/test/parser/samples/error-css-global-without-selector/input.svelte
new file mode 100644
--- /dev/null
+++ b/test/parser/samples/error-css-global-without-selector/input.svelte
@@ -0,0 +1,3 @@
+<style>
+	:global {}
+</style>
Repository: sveltejs/svelte (JavaScript)
Date: 2020-09-23 13:40:25+00:00
Task type: Bug Fix

Issue:
Keyed each is not reactive to key expression dependencies
https://svelte.dev/repl/b1ed6b7fc7cf47ce9fc75f0555bcd799?version=3.26.0
```svelte
<script>
	export let id = 0;
</script>
{#each ["foo", "bar"] as key(id + key)}
	{Math.random()}
{/each}
```
Expected a different result on every `id` change


Issue discussion:

Solution patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
 
 ## Unreleased
 
+* Fix keyed `{#each}` not reacting to key changing ([#5444](https://github.com/sveltejs/svelte/issues/5444))
 * Fix destructuring into store values ([#5449](https://github.com/sveltejs/svelte/issues/5449))
 * Fix erroneous `missing-declaration` warning with `use:obj.method` ([#5451](https://github.com/sveltejs/svelte/issues/5451))
 
diff --git a/src/compiler/compile/render_dom/wrappers/EachBlock.ts b/src/compiler/compile/render_dom/wrappers/EachBlock.ts
--- a/src/compiler/compile/render_dom/wrappers/EachBlock.ts
+++ b/src/compiler/compile/render_dom/wrappers/EachBlock.ts
@@ -239,6 +239,11 @@ export default class EachBlockWrapper extends Wrapper {
 		this.node.expression.dynamic_dependencies().forEach((dependency: string) => {
 			all_dependencies.add(dependency);
 		});
+		if (this.node.key) {
+			this.node.key.dynamic_dependencies().forEach((dependency: string) => {
+				all_dependencies.add(dependency);
+			});
+		}
 		this.dependencies = all_dependencies;
 
 		if (this.node.key) {


Test patch:
diff --git a/test/runtime/samples/each-block-keyed-dyanmic-key/_config.js b/test/runtime/samples/each-block-keyed-dyanmic-key/_config.js
new file mode 100644
--- /dev/null
+++ b/test/runtime/samples/each-block-keyed-dyanmic-key/_config.js
@@ -0,0 +1,27 @@
+let count = 0;
+let value = 'foo';
+
+export default {
+	props: {
+		value() {
+			count++;
+			return value;
+		}
+	},
+
+	html: `
+		<div>foo</div>
+		<div>foo</div>
+	`,
+
+	test({ assert, component, target }) {
+		value = 'bar';
+		component.id = 1;
+
+		assert.equal(count, 4);
+		assert.htmlEqual(target.innerHTML, `
+			<div>bar</div>
+			<div>bar</div>
+		`);
+	}
+};
diff --git a/test/runtime/samples/each-block-keyed-dyanmic-key/main.svelte b/test/runtime/samples/each-block-keyed-dyanmic-key/main.svelte
new file mode 100644
--- /dev/null
+++ b/test/runtime/samples/each-block-keyed-dyanmic-key/main.svelte
@@ -0,0 +1,8 @@
+<script>
+	export let id = 0;
+	export let value;
+</script>
+
+{#each ['foo', 'bar'] as key (id + key)}
+	<div>{value()}</div>
+{/each}
\ No newline at end of file
Repository: sveltejs/svelte (JavaScript)
Date: 2020-09-24 11:09:11+00:00
Task type: Bug Fix

Issue:
3.16.0 Support use:obj.method as actions returns a svelte(missing-decalaration)
Using support for 'use:obj.method={..}' returns:
- (!) Plugin svelte: 'test1.say' is not defined
- (!) Plugin svelte: 'test2.say' is not defined

```
<script>
  class Test {
    say(node, msg) {
      node.innerHTML = 'class: ' + msg;
    };
  }
  const test2 = new Test();

  const test1 = {
    say(node, msg) {
      node.innerHTML = 'obj: ' + msg;
    }
  };

  function test(node, msg) {
    node.innerHTML = msg;
  };
  let hi = 'Hi';
</script>

<div use:test={hi}></div>
<!-- svelte-ignore missing-declaration -->
<div use:test1.say={hi}></div>
<!-- svelte-ignore missing-declaration -->
<div use:test2.say={hi}></div> -->
```



Issue discussion:

Solution patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # Svelte changelog
 
+## Unreleased
+
+* Fix erroneous `missing-declaration` warning with `use:obj.method` ([#5451](https://github.com/sveltejs/svelte/issues/5451))
+
 ## 3.26.0
 
 * Support `use:obj.method` as actions ([#3935](https://github.com/sveltejs/svelte/issues/3935))
diff --git a/src/compiler/compile/nodes/Action.ts b/src/compiler/compile/nodes/Action.ts
--- a/src/compiler/compile/nodes/Action.ts
+++ b/src/compiler/compile/nodes/Action.ts
@@ -11,10 +11,11 @@ export default class Action extends Node {
 	constructor(component: Component, parent, scope, info) {
 		super(component, parent, scope, info);
 
-		component.warn_if_undefined(info.name, info, scope);
+		const object = info.name.split('.')[0];
+		component.warn_if_undefined(object, info, scope);
 
 		this.name = info.name;
-		component.add_reference(info.name.split('.')[0]);
+		component.add_reference(object);
 
 		this.expression = info.expression
 			? new Expression(component, this, scope, info.expression)


Test patch:
diff --git a/test/validator/samples/action-object/input.svelte b/test/validator/samples/action-object/input.svelte
new file mode 100644
--- /dev/null
+++ b/test/validator/samples/action-object/input.svelte
@@ -0,0 +1,11 @@
+<script>
+	const obj = {
+		foo : "bar",
+		action(element, { leet }) {
+			element.foo = this.foo + leet;
+		},
+	}
+</script>
+
+<button use:obj.action={{ leet: 1337 }}>action</button>
+<button use:foo.action={{ leet: 1337 }}>action</button>
\ No newline at end of file
diff --git a/test/validator/samples/action-object/warnings.json b/test/validator/samples/action-object/warnings.json
new file mode 100644
--- /dev/null
+++ b/test/validator/samples/action-object/warnings.json
@@ -0,0 +1,17 @@
+[
+	{
+		"code": "missing-declaration",
+		"end": {
+			"character": 217,
+			"column": 39,
+			"line": 11
+		},
+		"message": "'foo' is not defined",
+		"pos": 186,
+		"start": {
+			"character": 186,
+			"column": 8,
+			"line": 11
+		}
+	}
+]
Repository: sveltejs/svelte (JavaScript)
Date: 2020-11-17 14:27:49+00:00
Task type: Bug Fix

Issue:
Order of html tags changes when using key > if
I need to display html when variable (in this repl - `num`) is truthy

And I also need to animate `first` tag after each change of another variable(`slide`)

If I have html structure like this:
```svelte
{#key animateOnChangeVariable}
  {#if variableIsTrythy}
    <div class="first">First tag</div>
  {/if}
{/key}
<div class="second">Second tag</div>
```
And if `num` is changed, `first` tag is inserted after `second` (html order is changed)

REPL
https://svelte.dev/repl/3ba09b8c428c4ee58c77ff477b5fa632?version=3.29.7



If `{#if}` and `{#key}` swapped, everything works correctly


Also, if you have several buttons at the same time, which change num by clicking - an error is thrown (uncomment second button, uncomment function and get error `div1 is not defined`).


Issue discussion:
I hope I described bug clearly

Solution patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
 
 ## Unreleased
 
+* Fix ordering of elements when using `{#if}` inside `{#key}` ([#5680](https://github.com/sveltejs/svelte/issues/5680))
 * Add `hasContext` lifecycle function ([#5690](https://github.com/sveltejs/svelte/pull/5690))
 * Fix missing `walk` types in `svelte/compiler` ([#5696](https://github.com/sveltejs/svelte/pull/5696))
 
diff --git a/src/compiler/compile/render_dom/wrappers/KeyBlock.ts b/src/compiler/compile/render_dom/wrappers/KeyBlock.ts
--- a/src/compiler/compile/render_dom/wrappers/KeyBlock.ts
+++ b/src/compiler/compile/render_dom/wrappers/KeyBlock.ts
@@ -44,7 +44,7 @@ export default class KeyBlockWrapper extends Wrapper {
 			renderer,
 			this.block,
 			node.children,
-			parent,
+			this,
 			strip_whitespace,
 			next_sibling
 		);


Test patch:
diff --git a/test/runtime/samples/key-block-static-if/_config.js b/test/runtime/samples/key-block-static-if/_config.js
new file mode 100644
--- /dev/null
+++ b/test/runtime/samples/key-block-static-if/_config.js
@@ -0,0 +1,21 @@
+export default {
+	html: `
+		<section>
+			<div>Second</div>
+		</section>
+		<button>Click</button>
+	`,
+	async test({ assert, component, target, window }) {
+		const button = target.querySelector('button');
+
+		await button.dispatchEvent(new window.Event('click'));
+
+		assert.htmlEqual(target.innerHTML, `
+			<section>
+				<div>First</div>
+				<div>Second</div>
+			</section>
+			<button>Click</button>
+		`);
+	}
+};
diff --git a/test/runtime/samples/key-block-static-if/main.svelte b/test/runtime/samples/key-block-static-if/main.svelte
new file mode 100644
--- /dev/null
+++ b/test/runtime/samples/key-block-static-if/main.svelte
@@ -0,0 +1,17 @@
+<script>
+	let slide = 0;
+	let num = false;
+	
+	const changeNum = () => num = !num;
+</script>
+
+<section>
+	{#key slide}
+		{#if num}
+			<div>First</div>
+		{/if}
+	{/key}
+	<div>Second</div>
+</section>
+
+<button on:click={changeNum}>Click</button>
\ No newline at end of file
Repository: sveltejs/svelte (JavaScript)
Date: 2020-11-27 04:31:05+00:00
Task type: Bug Fix

Issue:
hasContext not exported
**Describe the bug**
`hasContext` is not exported from `src/runtime/index.ts`.

**Logs**
N/A

**To Reproduce**
Attempt to `import { hasContext } from 'svelte';`.

[REPL](https://svelte.dev/repl/6774f5ab24d146e19cb5fca6ac940389?version=3.30.0)

**Expected behavior**
I should be able to import the newly added `hasContext` lifecycle function.

**Stacktraces**
N/A

**Information about your Svelte project:**
N/A

**Severity**
Mild annoyance.

**Additional context**
This feature is brand new, so the export was likely just overlooked.



Issue discussion:

Solution patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # Svelte changelog
 
+## Unreleased
+
+* Actually export `hasContext` ([#5726](https://github.com/sveltejs/svelte/issues/5726))
+
 ## 3.30.0
 
 * Add a typed `SvelteComponent` interface ([#5431](https://github.com/sveltejs/svelte/pull/5431))
diff --git a/src/runtime/index.ts b/src/runtime/index.ts
--- a/src/runtime/index.ts
+++ b/src/runtime/index.ts
@@ -7,6 +7,7 @@ export {
 	afterUpdate,
 	setContext,
 	getContext,
+	hasContext,
 	tick,
 	createEventDispatcher,
 	SvelteComponentDev as SvelteComponent


Test patch:
diff --git a/test/runtime/samples/context-api-c/Leaf.svelte b/test/runtime/samples/context-api-c/Leaf.svelte
new file mode 100644
--- /dev/null
+++ b/test/runtime/samples/context-api-c/Leaf.svelte
@@ -0,0 +1,7 @@
+<script>
+	import { hasContext } from 'svelte';
+
+	const has = hasContext('test');
+</script>
+
+<div>{has}</div>
\ No newline at end of file
diff --git a/test/runtime/samples/context-api-c/Nested.svelte b/test/runtime/samples/context-api-c/Nested.svelte
new file mode 100644
--- /dev/null
+++ b/test/runtime/samples/context-api-c/Nested.svelte
@@ -0,0 +1,11 @@
+<script>
+	import { setContext } from 'svelte';
+
+	export let value = '';
+
+	if (value) {
+		setContext('test', value);
+	}
+</script>
+
+<slot></slot>
\ No newline at end of file
diff --git a/test/runtime/samples/context-api-c/_config.js b/test/runtime/samples/context-api-c/_config.js
new file mode 100644
--- /dev/null
+++ b/test/runtime/samples/context-api-c/_config.js
@@ -0,0 +1,6 @@
+export default {
+	html: `
+		<div>true</div>
+		<div>false</div>
+	`
+};
diff --git a/test/runtime/samples/context-api-c/main.svelte b/test/runtime/samples/context-api-c/main.svelte
new file mode 100644
--- /dev/null
+++ b/test/runtime/samples/context-api-c/main.svelte
@@ -0,0 +1,12 @@
+<script>
+  import Nested from "./Nested.svelte";
+  import Leaf from "./Leaf.svelte";
+</script>
+
+<Nested value="bar">
+  <Leaf />
+</Nested>
+
+<Nested>
+  <Leaf />
+</Nested>
Repository: sveltejs/svelte (JavaScript)
Date: 2021-01-29 02:35:52+00:00
Task type: Feature

Issue:
Expect a compile error when class binding name is empty
**Is your feature request related to a problem? Please describe.**
Yes. Sometimes dev's maybe thought that this is a bug

**Describe the solution you'd like**
The compiler should give a compile error


**Additional context**
```svelte
<h1 class:={true}>Hello!</h1>
```
https://svelte.dev/repl/4afa49d00f544af18d89594881340a54?version=3.31.2


Issue discussion:

Solution patch:
diff --git a/src/compiler/parse/state/tag.ts b/src/compiler/parse/state/tag.ts
--- a/src/compiler/parse/state/tag.ts
+++ b/src/compiler/parse/state/tag.ts
@@ -387,6 +387,13 @@ function read_attribute(parser: Parser, unique_names: Set<string>) {
 			}, start);
 		}
 
+		if (type === 'Class' && directive_name === '') {
+			parser.error({
+				code: 'invalid-class-directive',
+				message: 'Class binding name cannot be empty'
+			}, start + colon_index + 1);
+		}
+
 		if (value[0]) {
 			if ((value as any[]).length > 1 || value[0].type === 'Text') {
 				parser.error({


Test patch:
diff --git a/test/parser/samples/error-empty-classname-binding/error.json b/test/parser/samples/error-empty-classname-binding/error.json
new file mode 100644
--- /dev/null
+++ b/test/parser/samples/error-empty-classname-binding/error.json
@@ -0,0 +1,10 @@
+{
+	"code": "invalid-class-directive",
+	"message": "Class binding name cannot be empty",
+	"start": {
+		"line": 1,
+		"column": 10,
+		"character": 10
+	},
+	"pos": 10
+}
diff --git a/test/parser/samples/error-empty-classname-binding/input.svelte b/test/parser/samples/error-empty-classname-binding/input.svelte
new file mode 100644
--- /dev/null
+++ b/test/parser/samples/error-empty-classname-binding/input.svelte
@@ -0,0 +1 @@
+<h1 class:={true}>Hello</h1>
Repository: sveltejs/svelte (JavaScript)
Date: 2021-02-11 00:02:24+00:00
Task type: Bug Fix

Issue:
Since 3.32.2 a single :host style selector is removed when producing web components
Is there a reason why, but the `:host` style selector is removed when compiling this. Works in svelte 3.32.1, but not in 3.32.2.

```
<style>
    :host {
        display: inline-block;
    }
    .hello {
        color: green
    }
</style>
```
*Result:*
only the .hello class is available in the compiled web component.


Issue discussion:

Solution patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # Svelte changelog
 
+## Unreleased
+
+* Fix removal of lone `:host` selectors ([#5982](https://github.com/sveltejs/svelte/issues/5982))
+
 ## 3.32.2
 
 * Fix unnecessary additional invalidation with `<Component bind:prop={obj.foo}/>` ([#3075](https://github.com/sveltejs/svelte/issues/3075), [#4447](https://github.com/sveltejs/svelte/issues/4447), [#5555](https://github.com/sveltejs/svelte/issues/5555))
diff --git a/src/compiler/compile/css/Selector.ts b/src/compiler/compile/css/Selector.ts
--- a/src/compiler/compile/css/Selector.ts
+++ b/src/compiler/compile/css/Selector.ts
@@ -44,7 +44,10 @@ export default class Selector {
 		}
 
 		this.local_blocks = this.blocks.slice(0, i);
-		this.used = this.local_blocks.length === 0;
+
+		const host_only = this.blocks.length === 1 && this.blocks[0].host;
+
+		this.used = this.local_blocks.length === 0 || host_only;
 	}
 
 	apply(node: Element) {


Test patch:
diff --git a/test/css/samples/host/expected.css b/test/css/samples/host/expected.css
--- a/test/css/samples/host/expected.css
+++ b/test/css/samples/host/expected.css
@@ -1 +1 @@
-:host h1.svelte-xyz{color:red}:host>h1.svelte-xyz{color:red}:host>.svelte-xyz{color:red}:host span.svelte-xyz{color:red}
\ No newline at end of file
+:host h1.svelte-xyz{color:red}:host>h1.svelte-xyz{color:red}:host>.svelte-xyz{color:red}:host span.svelte-xyz{color:red}:host{color:red}
\ No newline at end of file
diff --git a/test/css/samples/host/input.svelte b/test/css/samples/host/input.svelte
--- a/test/css/samples/host/input.svelte
+++ b/test/css/samples/host/input.svelte
@@ -18,6 +18,10 @@
 	:host > span {
 		color: red;
 	}
+
+  :host {
+    color: red;
+  }
 </style>
 
 <h1>Hello!</h1>
Repository: sveltejs/svelte (JavaScript)
Date: 2021-03-21 13:43:01+00:00
Task type: Bug Fix

Issue:
Invalid "A11y: '#' is not a valid href attribute"
`<a href="#{'a'}">hello</a>`

The url is #a, not #.


Issue discussion:
```html
<script>
	let name = 'world';
</script>


<a href="#{name}">hello</a>
```

this seems to work 👀 

Solution patch:
diff --git a/src/compiler/compile/nodes/Attribute.ts b/src/compiler/compile/nodes/Attribute.ts
--- a/src/compiler/compile/nodes/Attribute.ts
+++ b/src/compiler/compile/nodes/Attribute.ts
@@ -96,7 +96,7 @@ export default class Attribute extends Node {
 	}
 
 	get_static_value() {
-		if (this.is_spread || this.dependencies.size > 0) return null;
+		if (!this.is_static) return null;
 
 		return this.is_true
 			? true


Test patch:
diff --git a/test/validator/samples/a11y-anchor-has-content/input.svelte b/test/validator/samples/a11y-anchor-has-content/input.svelte
--- a/test/validator/samples/a11y-anchor-has-content/input.svelte
+++ b/test/validator/samples/a11y-anchor-has-content/input.svelte
@@ -1 +1,2 @@
-<a href='/foo'></a>
\ No newline at end of file
+<a href='/foo'></a>
+<a href="#{'foo'}">bar</a>
Repository: sveltejs/svelte (JavaScript)
Date: 2021-05-04 20:17:42+00:00
Task type: Bug Fix

Issue:
No compile errors when passing empty directive names
Looks like I can pass empty directive names which can generate invalid JS code without any compilation errors or with unclear errors

For example in actions
```svelte
<element use: />
````
Parts of generated code looks like:
```javascript
dispose = action_destroyer(_action = .call(null, h1));
```

Same happens with event directive. but it does not throw JS syntax error
```javascript
dispose = listen(h1, "", /*_handler*/ ctx[0]);
```

With bind and animation directives. It throws an error because it is not able to look for the empty variable name in the component.

`[!] (plugin svelte) ValidationError:  is not declared`




Issue discussion:

Solution patch:
diff --git a/src/compiler/parse/state/tag.ts b/src/compiler/parse/state/tag.ts
--- a/src/compiler/parse/state/tag.ts
+++ b/src/compiler/parse/state/tag.ts
@@ -378,6 +378,13 @@ function read_attribute(parser: Parser, unique_names: Set<string>) {
 	if (type) {
 		const [directive_name, ...modifiers] = name.slice(colon_index + 1).split('|');
 
+		if (directive_name === '') {
+			parser.error({
+				code: 'empty-directive-name',
+				message: `${type} name cannot be empty`
+			}, start + colon_index + 1);
+		}
+
 		if (type === 'Binding' && directive_name !== 'this') {
 			check_unique(directive_name);
 		} else if (type !== 'EventHandler' && type !== 'Action') {
@@ -391,13 +398,6 @@ function read_attribute(parser: Parser, unique_names: Set<string>) {
 			}, start);
 		}
 
-		if (type === 'Class' && directive_name === '') {
-			parser.error({
-				code: 'invalid-class-directive',
-				message: 'Class binding name cannot be empty'
-			}, start + colon_index + 1);
-		}
-
 		if (value[0]) {
 			if ((value as any[]).length > 1 || value[0].type === 'Text') {
 				parser.error({


Test patch:
diff --git a/test/parser/samples/error-empty-classname-binding/error.json b/test/parser/samples/error-empty-classname-binding/error.json
--- a/test/parser/samples/error-empty-classname-binding/error.json
+++ b/test/parser/samples/error-empty-classname-binding/error.json
@@ -1,6 +1,6 @@
 {
-	"code": "invalid-class-directive",
-	"message": "Class binding name cannot be empty",
+	"code": "empty-directive-name",
+	"message": "Class name cannot be empty",
 	"start": {
 		"line": 1,
 		"column": 10,
diff --git a/test/parser/samples/error-empty-directive-name/error.json b/test/parser/samples/error-empty-directive-name/error.json
new file mode 100644
--- /dev/null
+++ b/test/parser/samples/error-empty-directive-name/error.json
@@ -0,0 +1,10 @@
+{
+	"code": "empty-directive-name",
+	"message": "Action name cannot be empty",
+	"start": {
+		"line": 1,
+		"column": 8,
+		"character": 8
+	},
+	"pos": 8
+}
diff --git a/test/parser/samples/error-empty-directive-name/input.svelte b/test/parser/samples/error-empty-directive-name/input.svelte
new file mode 100644
--- /dev/null
+++ b/test/parser/samples/error-empty-directive-name/input.svelte
@@ -0,0 +1 @@
+<h1 use:>Hello</h1>
Repository: sveltejs/svelte (JavaScript)
Date: 2021-06-22 07:26:38+00:00
Task type: Bug Fix

Issue:
:global applied to multiple selectors should be an error
**Describe the bug**
Prefixing a css global to give it scope only scopes the first selector.

**To Reproduce**
https://svelte.dev/repl/aaed36026d014e34b45aedef9630b55f?version=3.31.2

**Expected behavior**
```css
article.svelte-1nz7a1b div.svelte-1nz7a1b h1, article.svelte-1nz7a1b div.svelte-1nz7a1b h2, article.svelte-1nz7a1b div.svelte-1nz7a1b h3 {
    background-color: red;
}
```
**Current behaviour**
```css
article.svelte-1nz7a1b div.svelte-1nz7a1b h1, h2, h3 {
    background-color: red;
}
```

**Information about your Svelte project:**
Latest svelte repl.

**Severity**
Not severe.



Issue discussion:
Honestly I'm thinking that `:global(h1, h2, h3)` should probably be a compiler error. It's not really clear to me what it should mean. I don't think `article div :global(h1, h2, h3)` should be a shortcut for `article div :global(h1), article div :global(h2), article div :global(h3)`, which is what this issue seems to be suggesting.
It would be nice in the aspect of reducing redundant code, however keeping true to the native css way it would probably be best to not introduce some custom logic. But with that said, if `:global(h1, h2, h3)` would still continue to be acceptable I would regard this as unexpected behavior.

Solution patch:
diff --git a/src/compiler/compile/css/Selector.ts b/src/compiler/compile/css/Selector.ts
--- a/src/compiler/compile/css/Selector.ts
+++ b/src/compiler/compile/css/Selector.ts
@@ -143,6 +143,19 @@ export default class Selector {
 				});
 			}
 		}
+
+		for (const block of this.blocks) {
+			for (const selector of block.selectors) {
+				if (selector.type === 'PseudoClassSelector' && selector.name === 'global') {
+					if (/[^\\],/.test(selector.children[0].value)) {
+						component.error(selector, {
+							code: 'css-invalid-global-selector',
+							message: ':global(...) must contain a single selector'
+						});
+					}
+				}
+			}
+		}
 	}
 
 	get_amount_class_specificity_increased() {


Test patch:
diff --git a/test/validator/samples/css-invalid-global-selector/errors.json b/test/validator/samples/css-invalid-global-selector/errors.json
new file mode 100644
--- /dev/null
+++ b/test/validator/samples/css-invalid-global-selector/errors.json
@@ -0,0 +1,17 @@
+[
+	{
+		"code": "css-invalid-global-selector",
+		"message": ":global(...) must contain a single selector",
+		"start": {
+			"line": 5,
+			"column": 5,
+			"character": 58
+		},
+		"end": {
+			"line": 5,
+			"column": 24,
+			"character": 77
+		},
+		"pos": 58
+	}
+]
diff --git a/test/validator/samples/css-invalid-global-selector/input.svelte b/test/validator/samples/css-invalid-global-selector/input.svelte
new file mode 100644
--- /dev/null
+++ b/test/validator/samples/css-invalid-global-selector/input.svelte
@@ -0,0 +1,12 @@
+<style>
+	div :global(.h1\,h2\,h3) {
+		color: red;
+	}
+	div :global(h1, h2, h3) {
+		color: red;
+	}
+</style>
+
+<div>
+	<h1>hello world</h1>
+</div>
\ No newline at end of file
Repository: sveltejs/svelte (JavaScript)
Date: 2021-06-29 06:27:01+00:00
Task type: Bug Fix

Issue:
Site won't run with latest version of Svelte
### Describe the bug

The site won't run anymore with a recent version of Svelte probably due to https://github.com/sveltejs/svelte/issues/5907

There are at least some errors in `node_modules/@sveltejs/site-kit/components/Blurb.svelte`. Also potentially in this repo

### Reproduction

Update Svelte version in `site/package.json`:
```
"svelte": "^3.38.3"
```

### Logs

```shell
:global(...) can be at the start or end of a selector sequence, but not in the middle
```


### System Info

```shell
n/a
```


### Severity

blocking an upgrade


Issue discussion:

Solution patch:
diff --git a/src/compiler/compile/css/Selector.ts b/src/compiler/compile/css/Selector.ts
--- a/src/compiler/compile/css/Selector.ts
+++ b/src/compiler/compile/css/Selector.ts
@@ -610,7 +610,7 @@ class Block {
 			this.selectors.length >= 1 &&
 			this.selectors[0].type === 'PseudoClassSelector' &&
 			this.selectors[0].name === 'global' &&
-			this.selectors.every((selector) => selector.type === 'PseudoClassSelector')
+			this.selectors.every((selector) => selector.type === 'PseudoClassSelector' || selector.type === 'PseudoElementSelector')
 		);
 	}
 }


Test patch:
diff --git a/test/validator/samples/css-invalid-global-placement-3/errors.json b/test/validator/samples/css-invalid-global-placement-3/errors.json
new file mode 100644
--- /dev/null
+++ b/test/validator/samples/css-invalid-global-placement-3/errors.json
@@ -0,0 +1,15 @@
+[{
+	"code": "css-invalid-global",
+	"message": ":global(...) can be at the start or end of a selector sequence, but not in the middle",
+	"start": {
+		"line": 5,
+		"column": 6,
+		"character": 60
+	},
+	"end": {
+		"line": 5,
+		"column": 19,
+		"character": 73
+	},
+	"pos": 60
+}]
diff --git a/test/validator/samples/css-invalid-global-placement-3/input.svelte b/test/validator/samples/css-invalid-global-placement-3/input.svelte
new file mode 100644
--- /dev/null
+++ b/test/validator/samples/css-invalid-global-placement-3/input.svelte
@@ -0,0 +1,8 @@
+<style>
+	.foo :global(.bar)::after {
+		color: red;
+	}
+	.foo :global(.bar)::after .baz {
+		color: red;
+	}
+</style>
Repository: sveltejs/svelte (JavaScript)
Date: 2021-07-10 10:58:17+00:00
Task type: Bug Fix

Issue:
Select value not correctly displayed, if it has spread attibutes
**Describe the bug**
The element **Select** does not correctly process special attibute **value** if it has spread attributes.

**To Reproduce**
[REPL](https://svelte.dev/repl/a0699db0cec64268b7a5be1e4f8c71f0?version=3.38.3)

**Expected behavior**
Element **Select** must correctly display the specified **value**, regardless of the presence or absence of spreaded attributes.



Issue discussion:

Solution patch:
diff --git a/src/compiler/compile/render_dom/wrappers/Element/index.ts b/src/compiler/compile/render_dom/wrappers/Element/index.ts
--- a/src/compiler/compile/render_dom/wrappers/Element/index.ts
+++ b/src/compiler/compile/render_dom/wrappers/Element/index.ts
@@ -661,10 +661,10 @@ export default class ElementWrapper extends Wrapper {
 			}
 
 			block.chunks.mount.push(b`
-				if (${data}.multiple) @select_options(${this.var}, ${data}.value);
+				(${data}.multiple ? @select_options : @select_option)(${this.var}, ${data}.value);
 			`);
 			block.chunks.update.push(b`
-				if (${block.renderer.dirty(Array.from(dependencies))} && ${data}.multiple) @select_options(${this.var}, ${data}.value);
+				if (${block.renderer.dirty(Array.from(dependencies))}) (${data}.multiple ? @select_options : @select_option)(${this.var}, ${data}.value);;
 			`);
 		} else if (this.node.name === 'input' && this.attributes.find(attr => attr.node.name === 'value')) {
 			const type = this.node.get_static_attribute_value('type');


Test patch:
diff --git a/test/runtime/samples/spread-element-input-select/_config.js b/test/runtime/samples/spread-element-input-select/_config.js
new file mode 100644
--- /dev/null
+++ b/test/runtime/samples/spread-element-input-select/_config.js
@@ -0,0 +1,25 @@
+export default {
+	async test({ assert, component, target, window }) {
+		const select = target.querySelector('select');
+		const [option1, option2] = select.childNodes;
+
+		let selections = Array.from(select.selectedOptions);
+		assert.equal(selections.length, 1);
+		assert.ok(!selections.includes(option1));
+		assert.ok(selections.includes(option2));
+
+		component.value = 'Hello';
+
+		selections = Array.from(select.selectedOptions);
+		assert.equal(selections.length, 1);
+		assert.ok(selections.includes(option1));
+		assert.ok(!selections.includes(option2));
+
+		component.spread = { value: 'World' };
+
+		selections = Array.from(select.selectedOptions);
+		assert.equal(selections.length, 1);
+		assert.ok(!selections.includes(option1));
+		assert.ok(selections.includes(option2));
+	}
+};
diff --git a/test/runtime/samples/spread-element-input-select/main.svelte b/test/runtime/samples/spread-element-input-select/main.svelte
new file mode 100644
--- /dev/null
+++ b/test/runtime/samples/spread-element-input-select/main.svelte
@@ -0,0 +1,9 @@
+<script>
+  export let value = 'World';
+  export let spread = {};
+</script>
+
+<select {value} {...spread}>
+  <option>Hello</option>
+  <option>World</option>
+</select>
Repository: sveltejs/svelte (JavaScript)
Date: 2021-07-13 14:18:49+00:00
Task type: Bug Fix

Issue:
Setting a prop with accessors: true is not synchronized with bound values
### Describe the bug

When setting a value that is exposed through `accessors: true`, props in other components that are higher up and bound to this prop are not updated accordingly.

### Reproduction

Minimal reproduction:

https://svelte.dev/repl/e6cfa861c5254d8e8d2aa0d96149388e?version=3.38.3

### Logs

_No response_

### System Info

```shell
N/A
```


### Severity

annoyance


Issue discussion:

Solution patch:
diff --git a/src/compiler/compile/render_dom/index.ts b/src/compiler/compile/render_dom/index.ts
--- a/src/compiler/compile/render_dom/index.ts
+++ b/src/compiler/compile/render_dom/index.ts
@@ -151,7 +151,7 @@ export default function dom(
 					kind: 'set',
 					key: { type: 'Identifier', name: prop.export_name },
 					value: x`function(${prop.name}) {
-						this.$set({ ${prop.export_name}: ${prop.name} });
+						this.$$set({ ${prop.export_name}: ${prop.name} });
 						@flush();
 					}`
 				});


Test patch:
diff --git a/test/runtime/samples/component-binding-accessors/Nested.svelte b/test/runtime/samples/component-binding-accessors/Nested.svelte
new file mode 100644
--- /dev/null
+++ b/test/runtime/samples/component-binding-accessors/Nested.svelte
@@ -0,0 +1,5 @@
+<script>
+	export let value;
+</script>
+
+<input bind:value />
\ No newline at end of file
diff --git a/test/runtime/samples/component-binding-accessors/_config.js b/test/runtime/samples/component-binding-accessors/_config.js
new file mode 100644
--- /dev/null
+++ b/test/runtime/samples/component-binding-accessors/_config.js
@@ -0,0 +1,18 @@
+export default {
+	async test({ assert, component, target, window }) {
+		const [input1, input2] = target.querySelectorAll('input');
+		assert.equal(input1.value, 'something');
+		assert.equal(input2.value, 'something');
+
+		input1.value = 'abc';
+
+		await input1.dispatchEvent(new window.Event('input'));
+		assert.equal(input1.value, 'abc');
+		assert.equal(input2.value, 'abc');
+
+		await target.querySelector('button').dispatchEvent(new window.MouseEvent('click'));
+
+		assert.equal(input1.value, 'Reset');
+		assert.equal(input2.value, 'Reset');
+	}
+};
diff --git a/test/runtime/samples/component-binding-accessors/main.svelte b/test/runtime/samples/component-binding-accessors/main.svelte
new file mode 100644
--- /dev/null
+++ b/test/runtime/samples/component-binding-accessors/main.svelte
@@ -0,0 +1,12 @@
+<script>
+	import Nested from './Nested.svelte';
+	let value = 'something'
+	let c;
+</script>
+
+<Nested bind:this={c} bind:value />
+<input bind:value />
+
+<button on:click={() => {
+	c.value = 'Reset';
+}}>Reset</button>
\ No newline at end of file
Repository: sveltejs/svelte (JavaScript)
Date: 2021-09-06 14:50:15+00:00
Task type: Bug Fix

Issue:
Cannot read property 'subscribable' of undefined
### Describe the bug

Hello everyone,

Since svelte version 3.41, we cannot compile code containing default values in destruct.

Compilation exits with `Cannot read property 'subscribable' of undefined`

```svelte
<script>
	const myObject = {};
	const { foo: { bar } = {} } = myObject;
</script>
```

Svelte 3.40 : works fine
Svelte 3.41 : `Error compiling component. Cannot read property 'subscribable' of undefined`

This makes us rewrite all these assignements as :

```svelte
	const { bar } = myObject?.foo ?? {};
```

Did we miss something in the changelog ?

### Reproduction

3.40.3 : https://svelte.dev/repl/3fa45ef9bff943d3acdee9ba35fbc577?version=3.40.3
3.41.0 : https://svelte.dev/repl/3fa45ef9bff943d3acdee9ba35fbc577?version=3.41.0
Current: https://svelte.dev/repl/3fa45ef9bff943d3acdee9ba35fbc577?version=latest

### Logs

_No response_

### System Info

```shell
Repl environment
```


### Severity

annoyance


Issue discussion:
Probably related to a change in either #6578 or #6574

Solution patch:
diff --git a/src/compiler/compile/Component.ts b/src/compiler/compile/Component.ts
--- a/src/compiler/compile/Component.ts
+++ b/src/compiler/compile/Component.ts
@@ -1044,7 +1044,11 @@ export default class Component {
 											break;
 
 										case 'AssignmentPattern':
-											param.left = get_new_name(param.left);
+											if (param.left.type === 'Identifier') {
+												param.left = get_new_name(param.left);
+											} else {
+												rename_identifiers(param.left);
+											}
 											break;
 									}
 								}


Test patch:
diff --git a/test/runtime/samples/destructured-assignment-pattern-with-object-pattern/_config.js b/test/runtime/samples/destructured-assignment-pattern-with-object-pattern/_config.js
new file mode 100644
--- /dev/null
+++ b/test/runtime/samples/destructured-assignment-pattern-with-object-pattern/_config.js
@@ -0,0 +1,6 @@
+export default {
+	html: `
+		<div>hello undefined</div>
+		<div>hello bar2</div>
+	`
+};
diff --git a/test/runtime/samples/destructured-assignment-pattern-with-object-pattern/main.svelte b/test/runtime/samples/destructured-assignment-pattern-with-object-pattern/main.svelte
new file mode 100644
--- /dev/null
+++ b/test/runtime/samples/destructured-assignment-pattern-with-object-pattern/main.svelte
@@ -0,0 +1,11 @@
+<script>
+	const hoge = {};
+	const { foo: { bar } = {} } = hoge;
+
+
+	const hoge2 = {};
+	const { foo2: { bar2 } = { bar2: "bar2" } } = hoge2;
+</script>
+
+<div>hello {bar}</div>
+<div>hello {bar2}</div>