mirror of
				https://github.com/tc39/test262.git
				synced 2025-11-04 05:33:50 +01:00 
			
		
		
		
	The test as originally specified fails in all compatible parsers, but for the wrong reason. Below is an excerpt from V8, but all parser I tested behave the same:
```js
for (const x; false; ) {
           ^
SyntaxError: Missing initializer in const declaration
```
After the change the error is the assumed:
```js
  var x;
      ^
SyntaxError: Identifier 'x' has already been declared
```
		
	
			
		
			
				
	
	
		
			23 lines
		
	
	
		
			608 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			608 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
// Copyright (C) 2016 the V8 project authors. All rights reserved.
 | 
						|
// This code is governed by the BSD license found in the LICENSE file.
 | 
						|
/*---
 | 
						|
description: The body may not re-declare variables declared in the head
 | 
						|
info: |
 | 
						|
    IterationStatement :
 | 
						|
        for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
 | 
						|
 | 
						|
    It is a Syntax Error if any element of the BoundNames of LexicalDeclaration
 | 
						|
    also occurs in the VarDeclaredNames of Statement.
 | 
						|
negative:
 | 
						|
  phase: parse
 | 
						|
  type: SyntaxError
 | 
						|
esid: sec-for-statement
 | 
						|
es6id: 13.7.4
 | 
						|
---*/
 | 
						|
 | 
						|
$DONOTEVALUATE();
 | 
						|
 | 
						|
for (const x = 0; false; ) {
 | 
						|
  var x;
 | 
						|
}
 |