JDK-8057980 : let & const: remaining issues with lexical scoping
  • Type: Bug
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 8u40
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2014-09-09
  • Updated: 2015-06-04
  • Resolved: 2014-11-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u40 b17Fixed 9Fixed
Description
There are a few remaining issues with let/const after JDK-8051889:

 - let/const declarations should not be allowed in raw switch statements where the case clause does not have a block with explicit curly braces.
 - let/const should not be allowed in other unprotected statements such as if or while statements without explicit curly braces for the body of the statement.
 - for statement with let/const initializer should copy defined symbols from the outer to the inner block on each iteration (see http://esdiscuss.org/topic/in-es6-do-for-loops-with-a-let-const-initializer-create-a-separate-scope)