Closed Bug 422504 Opened 17 years ago Closed 13 years ago

Strange "redeclaration of const x" error

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
minor

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: jruderman, Unassigned)

Details

(Keywords: testcase)

js> function f() { { function a() 3; var a; return 5; } } js> f() 5 js> function f() { { function a() 3; const x; var a; return 5; } } js> f() typein:9: TypeError: redeclaration of const x The error message seems wrong, since |x| isn't redeclared. It also seems wrong that one function succeeds and the other throws. It also seems wrong that the error message comes at runtime rather than compile-time. This confuses an extension to jsfunfuzz, which expects that if X compiles, then try{X}catch(e){} does not throw. It also seems inefficient.
Both testcases now show 5 when run.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.