Closed Bug 1501998 Opened 6 years ago Closed 6 years ago

Improve syntax error messages involving yield

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1501798
Tracking Status
firefox65 --- affected

People

(Reporter: decoder, Unassigned)

References

Details

While inspecting some of the syntax errors that LangFuzz generates, I found the following testcase:


with ((yield 3)) {}

This causes:

test.js:1:13 SyntaxError: missing ) in parenthetical:
test.js:1:13 with ((yield 3)) {}
test.js:1:13 .............^

Omitting the parentheses around the yield gives me:

test.js:1:12 SyntaxError: missing ) after with-statement object:
test.js:1:12 with (yield 3) {}
test.js:1:12 ............^


These error messages are somewhat confusing because they suggest that a pair of parentheses is unbalanced while this is not the case.
The following changeset seemed to have caused the morph to the latter error messages, e.g. containing "after with-statement object":

autobisectjs shows this is probably related to the following changeset:

The first bad revision is:
changeset:   https://hg.mozilla.org/mozilla-central/rev/a0ccab2a6e28
user:        Morgan Phillips
date:        Thu Oct 22 20:05:37 2015 -0700
summary:     Bug 1192329 - Change JS shell to default to the standard version of JS (not 1.7+) 1/2; r=jorendorff

Jason, is bug 1192329 a likely regressor?
Blocks: 1192329
Flags: needinfo?(jorendorff)
No, that's a red herring. Maybe this test case would work better?

    if (this.version)
        version(0);
    eval("with ((yield 3)) {}");
Flags: needinfo?(jorendorff)
Using the testcase in comment 2:

autobisectjs shows this is probably related to the following changeset:

The first bad revision is:
changeset:   https://hg.mozilla.org/mozilla-central/rev/a0ccab2a6e28
user:        Morgan Phillips
date:        Thu Oct 22 20:05:37 2015 -0700
summary:     Bug 1192329 - Change JS shell to default to the standard version of JS (not 1.7+) 1/2; r=jorendorff

No, it doesn't seem to work better.

The parent changeset 988c2a1702b2 outputs: "SyntaxError: yield not in function:"
This changeset a0ccab2a6e28 outputs: "SyntaxError: missing ) in parenthetical:"

Tested with --enable-debug --enable-more-deterministic with --fuzzing-safe --no-threads --no-baseline --no-ion
Flags: needinfo?(jorendorff)
OK. Well, in any case it's not a recent regression. At least 3 years old, probably 10 years old.

Duping to the bug I already filed for this because Christian asked me to :)
Status: NEW → RESOLVED
Closed: 6 years ago
Flags: needinfo?(jorendorff)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.