bun version: 1.3.10
example:
function id(
value: ClassAccessorDecoratorTarget<any, any>,
context: ClassAccessorDecoratorContext,
): ClassAccessorDecoratorResult<any, any> {
return value
}
class Broken {
@id accessor label: string = ''
#name = 'hello'
#callback = () => this.#name
run() { return this.#callback() }
}
console.log(new Broken().run())
expected behavior:
hello
actual behavior:
SyntaxError: Cannot reference undeclared private names: "#name"
additional info:
When a class contains a @decorated accessor, Bun lowers all private #fields to WeakMap-based helpers (__privateAdd / __privateGet). The rewrite is correct inside methods and the constructor body, but missed inside class field initializer expressions. This affects all field initializer expressions (arrow functions, template literals, plain expressions).