Add tests for duplicate private methods (early-error) (#2308)

* Add tests for duplicate private methods

* Add generated js test files

* Fix indentation

* Add more features to tests

* Fix feature list format
This commit is contained in:
Qiming Ma 2019-08-29 10:17:37 -04:00 committed by Leo Balter
parent 71e40aad50
commit 407103728c
9 changed files with 207 additions and 0 deletions

View File

@ -0,0 +1,17 @@
// Copyright (C) 2019 Qiming Ma (Bloomberg LP). All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: It's a SyntaxError if a class contains a private async generator and a private field with the same name
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.
template: syntax/invalid
features: [class-methods-private, class-fields-private, async-iteration]
---*/
//- elements
#m;
async * #m() {}

View File

@ -0,0 +1,17 @@
// Copyright (C) 2019 Qiming Ma (Bloomberg LP). All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: It's a SyntaxError if a class contains a private async function and a private field with the same name
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.
template: syntax/invalid
features: [class-methods-private, class-fields-private, async-functions]
---*/
//- elements
#m;
async #m() {}

View File

@ -0,0 +1,17 @@
// Copyright (C) 2019 Qiming Ma (Bloomberg LP). All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: It's a SyntaxError if a class contains a private generator and a private field with the same name
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.
template: syntax/invalid
features: [class-methods-private, class-fields-private, generators]
---*/
//- elements
#m;
* #m() {}

View File

@ -0,0 +1,26 @@
// This file was procedurally generated from the following sources:
// - src/class-elements/grammar-privatemeth-duplicate-async-gen.case
// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template
/*---
description: It's a SyntaxError if a class contains a private async generator and a private field with the same name (class expression)
esid: prod-ClassElement
features: [class-methods-private, class-fields-private, async-iteration, 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.
---*/
$DONOTEVALUATE();
var C = class {
#m;
async * #m() {}
};

View File

@ -0,0 +1,26 @@
// This file was procedurally generated from the following sources:
// - src/class-elements/grammar-privatemeth-duplicate-async.case
// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template
/*---
description: It's a SyntaxError if a class contains a private async function and a private field with the same name (class expression)
esid: prod-ClassElement
features: [class-methods-private, class-fields-private, async-functions, 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.
---*/
$DONOTEVALUATE();
var C = class {
#m;
async #m() {}
};

View File

@ -0,0 +1,26 @@
// This file was procedurally generated from the following sources:
// - src/class-elements/grammar-privatemeth-duplicate-gen.case
// - src/class-elements/syntax/invalid/cls-expr-elements-invalid-syntax.template
/*---
description: It's a SyntaxError if a class contains a private generator and a private field with the same name (class expression)
esid: prod-ClassElement
features: [class-methods-private, class-fields-private, generators, 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.
---*/
$DONOTEVALUATE();
var C = class {
#m;
* #m() {}
};

View File

@ -0,0 +1,26 @@
// This file was procedurally generated from the following sources:
// - src/class-elements/grammar-privatemeth-duplicate-async-gen.case
// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
/*---
description: It's a SyntaxError if a class contains a private async generator and a private field with the same name (class declaration)
esid: prod-ClassElement
features: [class-methods-private, class-fields-private, async-iteration, 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.
---*/
$DONOTEVALUATE();
class C {
#m;
async * #m() {}
}

View File

@ -0,0 +1,26 @@
// This file was procedurally generated from the following sources:
// - src/class-elements/grammar-privatemeth-duplicate-async.case
// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
/*---
description: It's a SyntaxError if a class contains a private async function and a private field with the same name (class declaration)
esid: prod-ClassElement
features: [class-methods-private, class-fields-private, async-functions, 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.
---*/
$DONOTEVALUATE();
class C {
#m;
async #m() {}
}

View File

@ -0,0 +1,26 @@
// This file was procedurally generated from the following sources:
// - src/class-elements/grammar-privatemeth-duplicate-gen.case
// - src/class-elements/syntax/invalid/cls-decl-elements-invalid-syntax.template
/*---
description: It's a SyntaxError if a class contains a private generator and a private field with the same name (class declaration)
esid: prod-ClassElement
features: [class-methods-private, class-fields-private, generators, 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.
---*/
$DONOTEVALUATE();
class C {
#m;
* #m() {}
}