Skip to content

Identifier '#_' has already been declared #14605

@5P5

Description

@5P5

Describe the bug

svelte compiler cannot handle number class member correctly.

generates duplicate replacement private member #_
const x = new (class {
#_ = $.state();

get 1() {
	return $.get(this.#_);
}

set 1(value) {
	$.set(this.#_, $.proxy(value));
}

#_ = $.state();

get 2() {
	return $.get(this.#_);
}

set 2(value) {
	$.set(this.#_, $.proxy(value));
}
})();

N.B.:

🥴 
1= ➡️ #_
20= ➡️ #_0

🫠 
10= ➡️ #_0
20= ➡️ #_0

Identifier '#_0' has already been declared

Reproduction

repl

Logs

No response

System Info

version=5.8.1

blink: Identifier '#_0' has already been declared
gecko: getter and setter for private name #_ should either be both static or non-static

Severity

annoyance

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions