Bug 247786
| Summary: | Re-assignment to constant variable in for-in head | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Kanguk Lee <p51lee> |
| Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | Normal | CC: | mark.lam, webkit-bug-importer, yijia_huang, ysuzuki |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Local Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Kanguk Lee
// input.js
const x = 0 ; for ( { x } in [ 1 ] ) ;
_____________________
Hello,
Executing the input.js using JSC, it terminates normally, but TypeError is expected since there is an assignment to const.
Running the input.js with JSC results in:
---
$ jsc input.js
async
---
while other engines behave like:
---
# V8 (used console.log)
$ node input.js
input.js:1
const x = 0 ; for ( { x } in [ 1 ] ) ;
^
TypeError: Assignment to constant variable.
at Object.<anonymous> (input.js:1:23)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47
Node.js v18.11.0
# GraalJS
$ js input.js
TypeError: Assignment to constant "x"
at <js> :program(input.js:1:22)
---
WebKit version: 615.1.10
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/102325113>
Yijia Huang
This should be a duplicate of https://bugs.webkit.org/show_bug.cgi?id=247432 and should be fixed in PR https://commits.webkit.org/256580@main.
Just tested on ToT https://commits.webkit.org/256659@main. It is fixed.
*** This bug has been marked as a duplicate of bug 247432 ***