RESOLVED FIXED 197603
[JSC] Invalid AssignmentTargetType should be an early error.
https://bugs.webkit.org/show_bug.cgi?id=197603
Summary [JSC] Invalid AssignmentTargetType should be an early error.
Ross Kirsling
Reported 2019-05-05 22:09:25 PDT
Expressions like 0++, ++0, 0 = 0, and 0 += 0 are all specified as early errors, while JSC handles them as late errors: https://tc39.github.io/ecma262/#sec-update-expressions-static-semantics-early-errors https://tc39.github.io/ecma262/#sec-assignment-operators-static-semantics-early-errors In particular, they're all early ReferenceErrors, a notion that JSC doesn't currently have; however, as I noted in bug 177218 comment 2, I am in the midst of proposing that we drop this notion and let all early errors be SyntaxErrors: https://github.com/tc39/ecma262/pull/1527 With the hope that the above PR will meet with consensus in one month's time, I'd like to go ahead and turn these into early SyntaxErrors. Then if all goes well, we can simply do a Test262 import after the spec update.
Attachments
Patch (96.17 KB, patch)
2019-05-05 22:57 PDT, Ross Kirsling
no flags
Archive of layout-test-results from ews100 for mac-highsierra (3.15 MB, application/zip)
2019-05-06 00:03 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews107 for mac-highsierra-wk2 (2.71 MB, application/zip)
2019-05-06 00:15 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews115 for mac-highsierra (2.93 MB, application/zip)
2019-05-06 00:46 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews213 for win-future (13.49 MB, application/zip)
2019-05-06 00:56 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews122 for ios-simulator-wk2 (12.46 MB, application/zip)
2019-05-06 00:57 PDT, EWS Watchlist
no flags
Patch (105.54 KB, patch)
2019-05-06 11:02 PDT, Ross Kirsling
no flags
Patch (106.05 KB, patch)
2019-05-06 11:32 PDT, Ross Kirsling
no flags
Patch (108.60 KB, patch)
2019-05-06 21:03 PDT, Ross Kirsling
no flags
Archive of layout-test-results from ews213 for win-future (13.80 MB, application/zip)
2019-05-07 18:50 PDT, EWS Watchlist
no flags
Ross Kirsling
Comment 1 2019-05-05 22:09:44 PDT
*** Bug 190889 has been marked as a duplicate of this bug. ***
Ross Kirsling
Comment 2 2019-05-05 22:57:33 PDT Comment hidden (obsolete)
Ross Kirsling
Comment 3 2019-05-05 23:00:36 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 4 2019-05-06 00:03:14 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 5 2019-05-06 00:03:15 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 6 2019-05-06 00:15:25 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 7 2019-05-06 00:15:27 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 8 2019-05-06 00:46:39 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 9 2019-05-06 00:46:41 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 10 2019-05-06 00:56:21 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 11 2019-05-06 00:56:24 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 12 2019-05-06 00:57:10 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 13 2019-05-06 00:57:12 PDT Comment hidden (obsolete)
Ross Kirsling
Comment 14 2019-05-06 11:02:20 PDT Comment hidden (obsolete)
Ross Kirsling
Comment 15 2019-05-06 11:32:45 PDT Comment hidden (obsolete)
Ross Kirsling
Comment 16 2019-05-06 13:43:16 PDT
Comment on attachment 369147 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=369147&action=review > Source/JavaScriptCore/parser/Parser.cpp:3749 > if (UNLIKELY(context.isMetaProperty(lhs))) > internalFailWithMessage(false, metaPropertyName(context, lhs), " can't be the left hand side of an assignment expression"); > + semanticFailIfFalse(isSimpleAssignmentTarget(context, lhs), "Left side of assignment is not a reference"); Note: All of these isSimpleAssignmentTarget checks are colocated with !isMetaProperty checks -- the former subsumes the latter, so it might be nice to merge them. I've avoided touching them for now simply because I wanted to preserve error messages in the initial patch for review. (Notice that the only time an error *message* changes here is when hitting a requiresLExpr check (e.g. ++--x) in loose mode, since those checks used to be strict-mode-only and have their own unique messaging.)
Ross Kirsling
Comment 17 2019-05-06 21:03:09 PDT
EWS Watchlist
Comment 18 2019-05-07 18:50:49 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 19 2019-05-07 18:50:53 PDT Comment hidden (obsolete)
Ross Kirsling
Comment 20 2019-05-09 18:24:22 PDT
Reminder that this is ready for review. :)
Ross Kirsling
Comment 21 2019-05-16 10:33:50 PDT
Ping?
Keith Miller
Comment 22 2019-05-16 12:11:19 PDT
Comment on attachment 369224 [details] Patch r=me. I'm not 100% sure we should do SyntaxError until we have agreement at tc-39 but since I think that's the right choice anyway I'm ok with it. Can you file a bugzilla to track the PR on tc-39 though?
Ross Kirsling
Comment 23 2019-05-16 12:39:05 PDT
(In reply to Keith Miller from comment #22) > Comment on attachment 369224 [details] > Patch > > r=me. I'm not 100% sure we should do SyntaxError until we have agreement at > tc-39 but since I think that's the right choice anyway I'm ok with it. Can > you file a bugzilla to track the PR on tc-39 though? Thanks Keith! I'm leaving bug 177218 open for that purpose.
WebKit Commit Bot
Comment 24 2019-05-16 13:08:28 PDT
Comment on attachment 369224 [details] Patch Clearing flags on attachment: 369224 Committed r245406: <https://trac.webkit.org/changeset/245406>
WebKit Commit Bot
Comment 25 2019-05-16 13:08:30 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 26 2019-05-16 13:09:38 PDT
Note You need to log in before you can comment on or make changes to this bug.