Closed Bug 522858 Opened 16 years ago Closed 14 years ago

Using "let" in different blocks can produce an error message referring to previous declared variable

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 469758

People

(Reporter: afatecha, Unassigned)

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.14) Gecko/2009090217 Ubuntu/9.04 (jaunty) Firefox/3.0.14 Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.14) "let" declare a variable in a block scope, but a null pointer exception show a message referring a variable in a previous block. Reproducible: Always Steps to Reproduce: Test case : <script type="text/javascript;version=1.8"> if( true ) { let x = "Some value"; } if( true ) { let y = null; alert(y.value); } </script> Actual Results: x is null Expected Results: y is null This occur in firefox 3.5 too. This problem makes more difficult debugging.
Attached file HTML testcase
I can reproduce in a current tip Tracemonkey shell, as well as in Firefox 3.5 and Minefield: [gavin@gavin-mbp:~/mozilla/tracemonkey/obj-js]$ ./js js> if (true) { let x = "Some value"; } if (true) { let y = null; y.value; } typein:1: TypeError: x is null
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Linux → All
Hardware: x86_64 → All
Bug occurs in Firefox 3.0.14 as well. I suppose it may have been there since the introduction of "let".
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: