From 375ae592721185d962ebb3652acb05c26c4ce61d Mon Sep 17 00:00:00 2001 From: Kubilay Kahveci Date: Mon, 17 Sep 2018 21:52:40 +0100 Subject: [PATCH] Generate tests --- ...grammar-privatemeth-duplicate-get-field.js | 26 +++++++++++++++++++ .../grammar-privatemeth-duplicate-get-get.js | 26 +++++++++++++++++++ ...rammar-privatemeth-duplicate-meth-field.js | 26 +++++++++++++++++++ .../grammar-privatemeth-duplicate-meth-get.js | 26 +++++++++++++++++++ ...grammar-privatemeth-duplicate-meth-meth.js | 26 +++++++++++++++++++ .../grammar-privatemeth-duplicate-meth-set.js | 26 +++++++++++++++++++ ...-privatemeth-duplicate-meth-staticfield.js | 26 +++++++++++++++++++ ...r-privatemeth-duplicate-meth-staticmeth.js | 26 +++++++++++++++++++ ...grammar-privatemeth-duplicate-set-field.js | 26 +++++++++++++++++++ .../grammar-privatemeth-duplicate-set-set.js | 26 +++++++++++++++++++ .../grammar-privatemeth-duplicate-get-set.js | 21 +++++++++++++++ ...vatemeth-duplicate-meth-nestedclassmeth.js | 26 +++++++++++++++++++ ...grammar-privatemeth-duplicate-get-field.js | 26 +++++++++++++++++++ .../grammar-privatemeth-duplicate-get-get.js | 26 +++++++++++++++++++ ...rammar-privatemeth-duplicate-meth-field.js | 26 +++++++++++++++++++ .../grammar-privatemeth-duplicate-meth-get.js | 26 +++++++++++++++++++ ...grammar-privatemeth-duplicate-meth-meth.js | 26 +++++++++++++++++++ .../grammar-privatemeth-duplicate-meth-set.js | 26 +++++++++++++++++++ ...-privatemeth-duplicate-meth-staticfield.js | 26 +++++++++++++++++++ ...r-privatemeth-duplicate-meth-staticmeth.js | 26 +++++++++++++++++++ ...grammar-privatemeth-duplicate-set-field.js | 26 +++++++++++++++++++ .../grammar-privatemeth-duplicate-set-set.js | 26 +++++++++++++++++++ .../grammar-privatemeth-duplicate-get-set.js | 21 +++++++++++++++ ...vatemeth-duplicate-meth-nestedclassmeth.js | 26 +++++++++++++++++++ 24 files changed, 614 insertions(+) create mode 100644 test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js create mode 100644 test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js create mode 100644 test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js create mode 100644 test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js create mode 100644 test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js create mode 100644 test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js create mode 100644 test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js create mode 100644 test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js create mode 100644 test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js create mode 100644 test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js create mode 100644 test/language/expressions/class/syntax/valid/grammar-privatemeth-duplicate-get-set.js create mode 100644 test/language/expressions/class/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js create mode 100644 test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js create mode 100644 test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js create mode 100644 test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js create mode 100644 test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js create mode 100644 test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js create mode 100644 test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js create mode 100644 test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js create mode 100644 test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js create mode 100644 test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js create mode 100644 test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js create mode 100644 test/language/statements/class/syntax/valid/grammar-privatemeth-duplicate-get-set.js create mode 100644 test/language/statements/class/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js diff --git a/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js b/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js new file mode 100644 index 00000000000..708a25a7c4a --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-get-field.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private getter and a private field with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +var C = class { + #m; + get #m() {} +}; diff --git a/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js b/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js new file mode 100644 index 00000000000..ce0f9cc45ad --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-get-get.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains multiple private getters with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +var C = class { + get #m() {} + get #m() {} +}; diff --git a/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js b/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js new file mode 100644 index 00000000000..b8b0d8c319e --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-field.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private method and a private field with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +var C = class { + #m; + #m() {} +}; diff --git a/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js b/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js new file mode 100644 index 00000000000..f527330108c --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-get.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private method and a private getter with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +var C = class { + get #m() {} + #m() {} +}; diff --git a/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js b/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js new file mode 100644 index 00000000000..1b2f8d76949 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-meth.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains multiple private methods with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +var C = class { + #m() {} + #m() {} +}; diff --git a/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js b/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js new file mode 100644 index 00000000000..1751efda7fe --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-set.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private method and a private setter with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +var C = class { + set #m(_) {} + #m() {} +}; diff --git a/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js b/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js new file mode 100644 index 00000000000..fd942507493 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-staticfield.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private method and a private static field with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class-static-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +var C = class { + static #m; + #m() {} +}; diff --git a/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js b/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js new file mode 100644 index 00000000000..db805907e40 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-staticmeth.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private method and a private static method with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class-static-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +var C = class { + static #m() {} + #m() {} +}; diff --git a/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js b/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js new file mode 100644 index 00000000000..2773678aa53 --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-set-field.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private setter and a private field with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +var C = class { + #m; + set #m(_) {} +}; diff --git a/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js b/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js new file mode 100644 index 00000000000..d5d8b2c571c --- /dev/null +++ b/test/language/expressions/class/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-set-set.case +// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains multiple private setters with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +var C = class { + set #m(_) {} + set #m(_) {} +}; diff --git a/test/language/expressions/class/syntax/valid/grammar-privatemeth-duplicate-get-set.js b/test/language/expressions/class/syntax/valid/grammar-privatemeth-duplicate-get-set.js new file mode 100644 index 00000000000..ef2fa23405c --- /dev/null +++ b/test/language/expressions/class/syntax/valid/grammar-privatemeth-duplicate-get-set.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-get-set.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: It's valid if a class contains a private getter and a private setter with the same name (class expression) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +var C = class { + get #m() {} + set #m(_) {} +}; diff --git a/test/language/expressions/class/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js b/test/language/expressions/class/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js new file mode 100644 index 00000000000..525a48d02eb --- /dev/null +++ b/test/language/expressions/class/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-nestedclassmeth.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: It's valid if a nested class shadows a private method (class expression) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +var C = class { + constructor() { + class B { + #m() {} + } + } + + #m() {} +}; diff --git a/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js b/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js new file mode 100644 index 00000000000..d1c5145cadc --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-get-field.case +// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private getter and a private field with the same name (class declaration) +esid: prod-ClassElement +features: [class-methods-private, class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +class C { + #m; + get #m() {} +} diff --git a/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js b/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js new file mode 100644 index 00000000000..3699c120657 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-get-get.case +// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains multiple private getters with the same name (class declaration) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +class C { + get #m() {} + get #m() {} +} diff --git a/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js b/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js new file mode 100644 index 00000000000..1fe787bcb97 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-field.case +// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private method and a private field with the same name (class declaration) +esid: prod-ClassElement +features: [class-methods-private, class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +class C { + #m; + #m() {} +} diff --git a/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js b/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js new file mode 100644 index 00000000000..55d3bf1d612 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-get.case +// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private method and a private getter with the same name (class declaration) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +class C { + get #m() {} + #m() {} +} diff --git a/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js b/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js new file mode 100644 index 00000000000..80d292663f9 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-meth.case +// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains multiple private methods with the same name (class declaration) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +class C { + #m() {} + #m() {} +} diff --git a/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js b/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js new file mode 100644 index 00000000000..bdac36f2037 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-set.case +// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private method and a private setter with the same name (class declaration) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +class C { + set #m(_) {} + #m() {} +} diff --git a/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js b/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js new file mode 100644 index 00000000000..8a37a3f55cf --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-staticfield.case +// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private method and a private static field with the same name (class declaration) +esid: prod-ClassElement +features: [class-methods-private, class-static-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +class C { + static #m; + #m() {} +} diff --git a/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js b/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js new file mode 100644 index 00000000000..a57c63f1bb9 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-staticmeth.case +// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private method and a private static method with the same name (class declaration) +esid: prod-ClassElement +features: [class-methods-private, class-static-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +class C { + static #m() {} + #m() {} +} diff --git a/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js b/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js new file mode 100644 index 00000000000..b0d23620d10 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-set-field.case +// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains a private setter and a private field with the same name (class declaration) +esid: prod-ClassElement +features: [class-methods-private, class-fields-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +class C { + #m; + set #m(_) {} +} diff --git a/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js b/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js new file mode 100644 index 00000000000..27be0e806e6 --- /dev/null +++ b/test/language/statements/class/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-set-set.case +// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template +/*--- +description: It's a SyntaxError if a class contains multiple private setters with the same name (class declaration) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +class C { + set #m(_) {} + set #m(_) {} +} diff --git a/test/language/statements/class/syntax/valid/grammar-privatemeth-duplicate-get-set.js b/test/language/statements/class/syntax/valid/grammar-privatemeth-duplicate-get-set.js new file mode 100644 index 00000000000..e048cff9104 --- /dev/null +++ b/test/language/statements/class/syntax/valid/grammar-privatemeth-duplicate-get-set.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-get-set.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template +/*--- +description: It's valid if a class contains a private getter and a private setter with the same name (class declaration) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +class C { + get #m() {} + set #m(_) {} +} diff --git a/test/language/statements/class/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js b/test/language/statements/class/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js new file mode 100644 index 00000000000..35aa152b1b0 --- /dev/null +++ b/test/language/statements/class/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-privatemeth-duplicate-meth-nestedclassmeth.case +// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax.template +/*--- +description: It's valid if a nested class shadows a private method (class declaration) +esid: prod-ClassElement +features: [class-methods-private, class] +flags: [generated] +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries. + +---*/ + + +class C { + constructor() { + class B { + #m() {} + } + } + + #m() {} +}