Closed
Bug 1282431
Opened 10 years ago
Closed 8 years ago
Class redeclaration error message mentions "let" as cause
Categories
(Core :: JavaScript Engine, defect, P3)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla58
| Tracking | Status | |
|---|---|---|
| firefox58 | --- | fixed |
People
(Reporter: fs, Assigned: mcdonalds.only, Mentored)
References
(Blocks 1 open bug)
Details
(Keywords: triage-deferred)
Attachments
(1 file, 1 obsolete file)
|
2.18 KB,
patch
|
arai
:
review+
|
Details | Diff | Splinter Review |
In case you redeclare a class, the error message mentions `let` as the cause, which can be misleading when debugging. There is no `let` here at all:
> class Foo {}; class Foo {};
Firefox:
> SyntaxError: redeclaration of let Foo
Chrome:
> Uncaught SyntaxError: Identifier 'Foo' has already been declared
A more generic term like "identifier" works. If we can be specific, we could mention a "class redeclaration".
Updated•9 years ago
|
Keywords: triage-deferred
Priority: -- → P3
| Assignee | ||
Comment 1•8 years ago
|
||
I'm working on this.
Comment 2•8 years ago
|
||
Thank you!
Assignee: nobody → mcdonalds.only
Mentor: arai.unmht
Status: NEW → ASSIGNED
| Assignee | ||
Comment 3•8 years ago
|
||
If you redeclare a class, you will get following error message.
> class Foo {}; class Foo {};
> SyntaxError: redeclaration of let Foo
In this patch, you will get following clearer error message instead of above one.
> SyntaxError: redeclaration of class Foo
I added `Class` to `DeclarationKind` and `BindingKind`, but class is handled as same as `let` after parsing, which is the same way as before.
Attachment #8923681 -
Flags: review?(arai.unmht)
Comment 4•8 years ago
|
||
Comment on attachment 8923681 [details] [diff] [review]
Clarify error message for redeclaration of class
Review of attachment 8923681 [details] [diff] [review]:
-----------------------------------------------------------------
Thank you for your patch :D
As talked in person, the change to BindingKind seems to be unnecessary for error reporting.
(BindingKind's string representation is used in EmitterScope::dump, but it's only for debug purpose, and not exposed to web developers, so keeping it "Let" should be fine)
Attachment #8923681 -
Flags: review?(arai.unmht) → feedback+
| Assignee | ||
Comment 5•8 years ago
|
||
Thank you for your review!
I discarded changes to BindingKind.
Attachment #8923681 -
Attachment is obsolete: true
Attachment #8923685 -
Flags: review?(arai.unmht)
Comment 6•8 years ago
|
||
Comment on attachment 8923685 [details] [diff] [review]
Clarify error message for redeclaration of class
Review of attachment 8923685 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks again!
Here's try run (automation for build and test),
when it runs without failure, feel free to add "checkin-needed" keyword to this bug, so this patch will be landed shortly.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=7a89ff3c10296385c476f70d8a06881e48bb9cfe
Attachment #8923685 -
Flags: review?(arai.unmht) → review+
Updated•8 years ago
|
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/dafc1282a533
Clarify error message for redeclaration of class. r=arai
Keywords: checkin-needed
Comment 8•8 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox58:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
You need to log in
before you can comment on or make changes to this bug.
Description
•