From 20c38d3396bdf361459533dd131571911991cae4 Mon Sep 17 00:00:00 2001 From: Leo Balter <leonardo.balter@gmail.com> Date: Mon, 3 Dec 2018 15:02:09 -0500 Subject: [PATCH] Expand tests for duplicate lexical names of vardeclarednames in the same statementlist --- ...inner-block-var-declaration-after.template | 36 +++++++++++++++++++ ...clare-inner-block-var-declaration.template | 36 +++++++++++++++++++ ...o-redeclare-var-declaration-after.template | 20 +++++++++++ ...empt-to-redeclare-var-declaration.template | 22 ++++++++++++ ...clare-inner-block-var-declaration.template | 31 ++++++++++++++++ ...empt-to-redeclare-var-declaration.template | 17 +++++++++ ...inner-block-var-declaration-after.template | 36 +++++++++++++++++++ ...clare-inner-block-var-declaration.template | 36 +++++++++++++++++++ ...o-redeclare-var-declaration-after.template | 20 +++++++++++ ...empt-to-redeclare-var-declaration.template | 22 ++++++++++++ .../statements/for-in/bare-initializer.js | 3 +- .../statements/for-in/const-initializer.js | 2 +- .../statements/for-in/let-initializer.js | 2 +- .../statements/for-in/strict-initializer.js | 3 +- .../var-arraybindingpattern-initializer.js | 3 +- .../var-objectbindingpattern-initializer.js | 2 +- ...e-let-binding-with-function-declaration.js | 14 -------- ...tempt-to-redeclare-let-binding-with-var.js | 15 -------- 18 files changed, 282 insertions(+), 38 deletions(-) create mode 100644 src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-inner-block-var-declaration-after.template create mode 100644 src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-inner-block-var-declaration.template create mode 100644 src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-var-declaration-after.template create mode 100644 src/declarations/redeclare-allow-sloppy-function/fn-block-attempt-to-redeclare-var-declaration.template create mode 100644 src/declarations/redeclare-allow-var/block-attempt-to-redeclare-inner-block-var-declaration.template create mode 100644 src/declarations/redeclare-allow-var/fn-block-attempt-to-redeclare-var-declaration.template create mode 100644 src/declarations/redeclare/block-attempt-to-redeclare-inner-block-var-declaration-after.template create mode 100644 src/declarations/redeclare/block-attempt-to-redeclare-inner-block-var-declaration.template create mode 100644 src/declarations/redeclare/block-attempt-to-redeclare-var-declaration-after.template create mode 100644 src/declarations/redeclare/fn-block-attempt-to-redeclare-var-declaration.template delete mode 100644 test/language/statements/let/syntax/attempt-to-redeclare-let-binding-with-function-declaration.js delete mode 100644 test/language/statements/let/syntax/attempt-to-redeclare-let-binding-with-var.js diff --git a/src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-inner-block-var-declaration-after.template b/src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-inner-block-var-declaration-after.template new file mode 100644 index 0000000000..82a470b70a --- /dev/null +++ b/src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-inner-block-var-declaration-after.template @@ -0,0 +1,36 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/block-scope/syntax/redeclaration/inner-block-var-declaration-attempt-2-to- +name: VariableDeclaration in a BlockStatement inside a BlockStatement +esid: sec-block-static-semantics-early-errors +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + + Static Semantics: VarDeclaredNames + + Block : { } + + 1. Return a new empty List. + + StatementList : StatementList StatementListItem + + 1. Let names be VarDeclaredNames of StatementList. + 2. Append to names the elements of the VarDeclaredNames of StatementListItem. + 3. Return names. + + StatementListItem : Declaration + + 1. Return a new empty List. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +{ /*{ body }*/ { var f; } } diff --git a/src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-inner-block-var-declaration.template b/src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-inner-block-var-declaration.template new file mode 100644 index 0000000000..1ded0f4e08 --- /dev/null +++ b/src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-inner-block-var-declaration.template @@ -0,0 +1,36 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/block-scope/syntax/redeclaration/inner-block-var-declaration-attempt-to- +name: VariableDeclaration in a BlockStatement inside a BlockStatement +esid: sec-block-static-semantics-early-errors +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + + Static Semantics: VarDeclaredNames + + Block : { } + + 1. Return a new empty List. + + StatementList : StatementList StatementListItem + + 1. Let names be VarDeclaredNames of StatementList. + 2. Append to names the elements of the VarDeclaredNames of StatementListItem. + 3. Return names. + + StatementListItem : Declaration + + 1. Return a new empty List. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +{ { var f; } /*{ body }*/ } diff --git a/src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-var-declaration-after.template b/src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-var-declaration-after.template new file mode 100644 index 0000000000..b6d1d6e75c --- /dev/null +++ b/src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-var-declaration-after.template @@ -0,0 +1,20 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/block-scope/syntax/redeclaration/var-declaration-attempt-2-to- +name: VariableDeclaration in BlockStatement +esid: sec-block-static-semantics-early-errors +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +{ /*{ body }*/; var f; } diff --git a/src/declarations/redeclare-allow-sloppy-function/fn-block-attempt-to-redeclare-var-declaration.template b/src/declarations/redeclare-allow-sloppy-function/fn-block-attempt-to-redeclare-var-declaration.template new file mode 100644 index 0000000000..aeeb8e4537 --- /dev/null +++ b/src/declarations/redeclare-allow-sloppy-function/fn-block-attempt-to-redeclare-var-declaration.template @@ -0,0 +1,22 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/block-scope/syntax/redeclaration/fn-scope-var-declaration-attempt-to- +name: VariableDeclaration in BlockStatement inside a function +esid: sec-block-static-semantics-early-errors +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function x() { + { /*{ body }*/; var f; } +} diff --git a/src/declarations/redeclare-allow-var/block-attempt-to-redeclare-inner-block-var-declaration.template b/src/declarations/redeclare-allow-var/block-attempt-to-redeclare-inner-block-var-declaration.template new file mode 100644 index 0000000000..c30b81633d --- /dev/null +++ b/src/declarations/redeclare-allow-var/block-attempt-to-redeclare-inner-block-var-declaration.template @@ -0,0 +1,31 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/block-scope/syntax/redeclaration/inner-block-var-declaration-attempt-to- +name: VariableDeclaration in a BlockStatement inside a BlockStatement +esid: sec-block-static-semantics-early-errors +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + + Static Semantics: VarDeclaredNames + + Block : { } + + 1. Return a new empty List. + + StatementList : StatementList StatementListItem + + 1. Let names be VarDeclaredNames of StatementList. + 2. Append to names the elements of the VarDeclaredNames of StatementListItem. + 3. Return names. + + StatementListItem : Declaration + + 1. Return a new empty List. +---*/ + +{ { var f; } /*{ body }*/ } diff --git a/src/declarations/redeclare-allow-var/fn-block-attempt-to-redeclare-var-declaration.template b/src/declarations/redeclare-allow-var/fn-block-attempt-to-redeclare-var-declaration.template new file mode 100644 index 0000000000..d3737a09c5 --- /dev/null +++ b/src/declarations/redeclare-allow-var/fn-block-attempt-to-redeclare-var-declaration.template @@ -0,0 +1,17 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/block-scope/syntax/redeclaration/fn-scope-var-declaration-attempt-to- +name: VariableDeclaration in BlockStatement inside a function +esid: sec-block-static-semantics-early-errors +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. +---*/ + +function x() { + { var f; /*{ body }*/ } +} diff --git a/src/declarations/redeclare/block-attempt-to-redeclare-inner-block-var-declaration-after.template b/src/declarations/redeclare/block-attempt-to-redeclare-inner-block-var-declaration-after.template new file mode 100644 index 0000000000..5ac1cdae64 --- /dev/null +++ b/src/declarations/redeclare/block-attempt-to-redeclare-inner-block-var-declaration-after.template @@ -0,0 +1,36 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/block-scope/syntax/redeclaration/inner-block-var-declaration-attempt-2-to- +name: VariableDeclaration in a BlockStatement inside a BlockStatement +esid: sec-block-static-semantics-early-errors +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + + Static Semantics: VarDeclaredNames + + Block : { } + + 1. Return a new empty List. + + StatementList : StatementList StatementListItem + + 1. Let names be VarDeclaredNames of StatementList. + 2. Append to names the elements of the VarDeclaredNames of StatementListItem. + 3. Return names. + + StatementListItem : Declaration + + 1. Return a new empty List. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +{ /*{ body }*/; { var f; } } diff --git a/src/declarations/redeclare/block-attempt-to-redeclare-inner-block-var-declaration.template b/src/declarations/redeclare/block-attempt-to-redeclare-inner-block-var-declaration.template new file mode 100644 index 0000000000..710a2cc717 --- /dev/null +++ b/src/declarations/redeclare/block-attempt-to-redeclare-inner-block-var-declaration.template @@ -0,0 +1,36 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/block-scope/syntax/redeclaration/inner-block-var-declaration-attempt-to- +name: VariableDeclaration in a BlockStatement inside a BlockStatement +esid: sec-block-static-semantics-early-errors +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + + Static Semantics: VarDeclaredNames + + Block : { } + + 1. Return a new empty List. + + StatementList : StatementList StatementListItem + + 1. Let names be VarDeclaredNames of StatementList. + 2. Append to names the elements of the VarDeclaredNames of StatementListItem. + 3. Return names. + + StatementListItem : Declaration + + 1. Return a new empty List. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +{ { var f; } /*{ body }*/; } diff --git a/src/declarations/redeclare/block-attempt-to-redeclare-var-declaration-after.template b/src/declarations/redeclare/block-attempt-to-redeclare-var-declaration-after.template new file mode 100644 index 0000000000..b6d1d6e75c --- /dev/null +++ b/src/declarations/redeclare/block-attempt-to-redeclare-var-declaration-after.template @@ -0,0 +1,20 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/block-scope/syntax/redeclaration/var-declaration-attempt-2-to- +name: VariableDeclaration in BlockStatement +esid: sec-block-static-semantics-early-errors +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +{ /*{ body }*/; var f; } diff --git a/src/declarations/redeclare/fn-block-attempt-to-redeclare-var-declaration.template b/src/declarations/redeclare/fn-block-attempt-to-redeclare-var-declaration.template new file mode 100644 index 0000000000..aeeb8e4537 --- /dev/null +++ b/src/declarations/redeclare/fn-block-attempt-to-redeclare-var-declaration.template @@ -0,0 +1,22 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/block-scope/syntax/redeclaration/fn-scope-var-declaration-attempt-to- +name: VariableDeclaration in BlockStatement inside a function +esid: sec-block-static-semantics-early-errors +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function x() { + { /*{ body }*/; var f; } +} diff --git a/test/annexB/language/statements/for-in/bare-initializer.js b/test/annexB/language/statements/for-in/bare-initializer.js index 9ff65b270a..fd9d060fa4 100644 --- a/test/annexB/language/statements/for-in/bare-initializer.js +++ b/test/annexB/language/statements/for-in/bare-initializer.js @@ -11,6 +11,5 @@ negative: $DONOTEVALUATE(); var a; -throw NotEarlyError; -for (a = 0 in {}); +for (a = 0 in {}); diff --git a/test/annexB/language/statements/for-in/const-initializer.js b/test/annexB/language/statements/for-in/const-initializer.js index c73605beea..2ecfcad11c 100644 --- a/test/annexB/language/statements/for-in/const-initializer.js +++ b/test/annexB/language/statements/for-in/const-initializer.js @@ -10,6 +10,6 @@ negative: ---*/ $DONOTEVALUATE(); -throw NotEarlyError; + for (const a = 0 in {}); diff --git a/test/annexB/language/statements/for-in/let-initializer.js b/test/annexB/language/statements/for-in/let-initializer.js index 06415a7f99..edd4e508d0 100644 --- a/test/annexB/language/statements/for-in/let-initializer.js +++ b/test/annexB/language/statements/for-in/let-initializer.js @@ -10,6 +10,6 @@ negative: ---*/ $DONOTEVALUATE(); -throw NotEarlyError; + for (let a = 0 in {}); diff --git a/test/annexB/language/statements/for-in/strict-initializer.js b/test/annexB/language/statements/for-in/strict-initializer.js index dec0523c57..f81e59f7cd 100644 --- a/test/annexB/language/statements/for-in/strict-initializer.js +++ b/test/annexB/language/statements/for-in/strict-initializer.js @@ -11,6 +11,5 @@ flags: [onlyStrict] ---*/ $DONOTEVALUATE(); -throw NotEarlyError; -for (var a = 0 in {}); +for (var a = 0 in {}); diff --git a/test/annexB/language/statements/for-in/var-arraybindingpattern-initializer.js b/test/annexB/language/statements/for-in/var-arraybindingpattern-initializer.js index ac5ca2a8a3..8682e07003 100644 --- a/test/annexB/language/statements/for-in/var-arraybindingpattern-initializer.js +++ b/test/annexB/language/statements/for-in/var-arraybindingpattern-initializer.js @@ -10,6 +10,5 @@ negative: ---*/ $DONOTEVALUATE(); -throw NotEarlyError; -for (var [a] = 0 in {}); +for (var [a] = 0 in {}); diff --git a/test/annexB/language/statements/for-in/var-objectbindingpattern-initializer.js b/test/annexB/language/statements/for-in/var-objectbindingpattern-initializer.js index 91fd1e78ad..7c156c7e0c 100644 --- a/test/annexB/language/statements/for-in/var-objectbindingpattern-initializer.js +++ b/test/annexB/language/statements/for-in/var-objectbindingpattern-initializer.js @@ -10,6 +10,6 @@ negative: ---*/ $DONOTEVALUATE(); -throw NotEarlyError; + for (var {a} = 0 in {}); diff --git a/test/language/statements/let/syntax/attempt-to-redeclare-let-binding-with-function-declaration.js b/test/language/statements/let/syntax/attempt-to-redeclare-let-binding-with-function-declaration.js deleted file mode 100644 index 51a0816b71..0000000000 --- a/test/language/statements/let/syntax/attempt-to-redeclare-let-binding-with-function-declaration.js +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (C) 2011 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: B.3.3 -description: > - redeclaration within block: - attempt to redeclare let binding with function declaration -negative: - phase: parse - type: SyntaxError ----*/ - -$DONOTEVALUATE(); -{ let f; function f() {} } diff --git a/test/language/statements/let/syntax/attempt-to-redeclare-let-binding-with-var.js b/test/language/statements/let/syntax/attempt-to-redeclare-let-binding-with-var.js deleted file mode 100644 index 2f9d74e6e7..0000000000 --- a/test/language/statements/let/syntax/attempt-to-redeclare-let-binding-with-var.js +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2011 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: B.3.3 -description: > - redeclaration within block: - attempt to redeclare let binding with var -negative: - phase: parse - type: SyntaxError ----*/ - -$DONOTEVALUATE(); -{ let f; var f; } - -- GitLab