I can also reproduce this in the shell:
```js
class Mainclass {
#declaredPrivateField = 42; // Line 2
}
m.#declaredPrivateField = 23; // Line 5
m.#undeclaredPrivateField = 23; // Line 6
``
With line 5 commented out we get
```
/Users/mgaudet/tmp/t.js:6:2 SyntaxError: reference to undeclared private field or method #undeclaredPrivateField:
/Users/mgaudet/tmp/t.js:6:2 m.#undeclaredPrivateField = 23; // Line 6
/Users/mgaudet/tmp/t.js:6:2 ..^
```
With line 5 un-commented, we get:
```
/Users/mgaudet/tmp/t.js:2:4 SyntaxError: reference to undeclared private field or method #declaredPrivateField
```
My recollection was that we stored information in the used names tracker to handle these sorts of error message problems, but this is definitely a huge paper cut.
Bug 1770609 Comment 3 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
I can also reproduce this in the shell:
```js
class Mainclass {
#declaredPrivateField = 42; // Line 2
}
m.#declaredPrivateField = 23; // Line 5
m.#undeclaredPrivateField = 23; // Line 6
```
With line 5 commented out we get
```
/Users/mgaudet/tmp/t.js:6:2 SyntaxError: reference to undeclared private field or method #undeclaredPrivateField:
/Users/mgaudet/tmp/t.js:6:2 m.#undeclaredPrivateField = 23; // Line 6
/Users/mgaudet/tmp/t.js:6:2 ..^
```
With line 5 un-commented, we get:
```
/Users/mgaudet/tmp/t.js:2:4 SyntaxError: reference to undeclared private field or method #declaredPrivateField
```
My recollection was that we stored information in the used names tracker to handle these sorts of error message problems, but this is definitely a huge paper cut.