Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Issue 1236863008: Improve error message for duplicate parameters (Closed)

Created:
5 years, 5 months ago by Dan Ehrenberg
Modified:
5 years, 5 months ago
Reviewers:
wingo, adamk
CC:
v8-dev, ulan
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Improve error message for duplicate parameters Duplicate parameters are banned both overall in strict mode and also in arrow functions. Our error message for both cases blamed strict mode, which is confusing. This patch fixes the message to point to arrow functions as a possible source as well. R=wingo, adamk LOG=N Committed: https://crrev.com/5c036cd7729d6cfaa6c390bfc070fdc02a8d800d Cr-Commit-Position: refs/heads/master@{#29662}

Patch Set 1 #

Patch Set 2 : Fix test failure #

Patch Set 3 : Better error message #

Patch Set 4 : arrow function test #

Total comments: 1

Patch Set 5 : pass flags to test #

Patch Set 6 : Fix webkit test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+13 lines, -14 lines) Patch
M src/expression-classifier.h View 1 chunk +1 line, -2 lines 0 comments Download
M src/messages.h View 1 2 3 chunks +1 line, -4 lines 0 comments Download
M src/parser.cc View 1 1 chunk +1 line, -1 line 0 comments Download
A + test/message/arrow-formal-parameters.js View 1 2 3 4 1 chunk +2 lines, -3 lines 0 comments Download
A test/message/arrow-formal-parameters.out View 1 2 3 4 1 chunk +4 lines, -0 lines 0 comments Download
M test/message/strict-formal-parameters.out View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M test/webkit/fast/js/basic-strict-mode-expected.txt View 1 2 3 4 5 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 21 (7 generated)
Dan Ehrenberg
5 years, 5 months ago (2015-07-13 22:41:24 UTC) #1
adamk
Can you add an error message test for the arrow function case? I'm also curious ...
5 years, 5 months ago (2015-07-13 23:55:59 UTC) #4
Dan Ehrenberg
On 2015/07/13 23:55:59, adamk wrote: > Can you add an error message test for the ...
5 years, 5 months ago (2015-07-14 03:21:37 UTC) #5
Dan Ehrenberg
On 2015/07/14 03:21:37, Dan Ehrenberg wrote: > On 2015/07/13 23:55:59, adamk wrote: > > Can ...
5 years, 5 months ago (2015-07-14 17:38:37 UTC) #6
adamk
Sorry to ask again, but can you add a message test for the arrow function ...
5 years, 5 months ago (2015-07-14 18:10:40 UTC) #7
Dan Ehrenberg
On 2015/07/14 18:10:40, adamk wrote: > Sorry to ask again, but can you add a ...
5 years, 5 months ago (2015-07-14 19:09:36 UTC) #8
adamk
lgtm % flag (see below) https://codereview.chromium.org/1236863008/diff/80001/test/message/arrow-formal-parameters.js File test/message/arrow-formal-parameters.js (right): https://codereview.chromium.org/1236863008/diff/80001/test/message/arrow-formal-parameters.js#newcode4 test/message/arrow-formal-parameters.js:4: Please add a --harmony-arrow-functions ...
5 years, 5 months ago (2015-07-14 19:16:19 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1236863008/100001
5 years, 5 months ago (2015-07-14 20:24:45 UTC) #12
commit-bot: I haz the power
Try jobs failed on following builders: v8_linux_arm64_rel on tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_arm64_rel/builds/7661) (exceeded global retry quota)
5 years, 5 months ago (2015-07-14 20:38:50 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1236863008/120001
5 years, 5 months ago (2015-07-14 20:59:27 UTC) #17
commit-bot: I haz the power
Committed patchset #6 (id:120001)
5 years, 5 months ago (2015-07-14 21:59:00 UTC) #18
commit-bot: I haz the power
Patchset 6 (id:??) landed as https://crrev.com/5c036cd7729d6cfaa6c390bfc070fdc02a8d800d Cr-Commit-Position: refs/heads/master@{#29662}
5 years, 5 months ago (2015-07-14 21:59:13 UTC) #19
wingo
I would note that naming a test "strict-formal-parameters" as opposed to arrow formal parameters can ...
5 years, 5 months ago (2015-07-15 08:55:15 UTC) #20
adamk
5 years, 5 months ago (2015-07-15 20:05:01 UTC) #21
Message was sent while issue was closed.
On 2015/07/15 08:55:15, wingo wrote:
> I would note that naming a test "strict-formal-parameters" as opposed to arrow
> formal parameters can be misleading as arrow function parameters are indeed
> StringFormalParameters, which is a strange grammar production in the spec
which
> does not imply strict mode, only that params should not be duplicates.  ACK
that
> that's impossible to communicate to a user though :)
> 
> I think I would have kept the error messages apart.  Better to be told "arrow
> functions can't have duplicate parameters" than "duplicate parameters not
> allowed in this context".  YMMV though.

I don't think it's a big deal (I suspect that duplicate parameter names are
always a programming error), but I'd be happy to review a patch that added the
necessary bookkeeping to produce different error messages for these cases (in
the same patch one could probably also fix the arrow function message to point
to the dup parameter).

Powered by Google App Engine
This is Rietveld 408576698