mirror of https://github.com/tc39/test262.git
test: Add tests for duplicate private methods (early-errors)
This commit is contained in:
parent
fec7982e09
commit
6b808920dd
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright (C) 2018 Kubilay Kahveci (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 getter 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]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- elements
|
||||||
|
#m;
|
||||||
|
get #m() {}
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright (C) 2018 Kubilay Kahveci (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 multiple private getters 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]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- elements
|
||||||
|
get #m() {}
|
||||||
|
get #m() {}
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright (C) 2018 Kubilay Kahveci (Bloomberg LP). All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: It's valid if a class contains a private getter and a private setter 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/valid
|
||||||
|
features: [class-methods-private]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- elements
|
||||||
|
get #m() {}
|
||||||
|
set #m(_) {}
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright (C) 2018 Kubilay Kahveci (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 method 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]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- elements
|
||||||
|
#m;
|
||||||
|
#m() {}
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright (C) 2018 Kubilay Kahveci (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 method and a private getter 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]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- elements
|
||||||
|
get #m() {}
|
||||||
|
#m() {}
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright (C) 2018 Kubilay Kahveci (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 multiple private methods 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]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- elements
|
||||||
|
#m() {}
|
||||||
|
#m() {}
|
|
@ -0,0 +1,22 @@
|
||||||
|
// Copyright (C) 2018 Kubilay Kahveci (Bloomberg LP). All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: It's valid if a nested class shadows a private method
|
||||||
|
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/valid
|
||||||
|
features: [class-methods-private]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- elements
|
||||||
|
constructor() {
|
||||||
|
class B {
|
||||||
|
#m() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#m() {}
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright (C) 2018 Kubilay Kahveci (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 method and a private setter 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]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- elements
|
||||||
|
set #m(_) {}
|
||||||
|
#m() {}
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright (C) 2018 Kubilay Kahveci (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 method and a private static 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-static-fields-private]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- elements
|
||||||
|
static #m;
|
||||||
|
#m() {}
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright (C) 2018 Kubilay Kahveci (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 method and a private static method 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-static-methods-private]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- elements
|
||||||
|
static #m() {}
|
||||||
|
#m() {}
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright (C) 2018 Kubilay Kahveci (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 setter 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]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- elements
|
||||||
|
#m;
|
||||||
|
set #m(_) {}
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright (C) 2018 Kubilay Kahveci (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 multiple private setters 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]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- elements
|
||||||
|
set #m(_) {}
|
||||||
|
set #m(_) {}
|
Loading…
Reference in New Issue