Added tests and accept baselines
This commit is contained in:
parent
8ef9599bac
commit
ec7e80e377
|
@ -0,0 +1,42 @@
|
|||
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility4.ts(16,9): error TS2673: Constructor of class 'A' is private and only accessible within the class declaration.
|
||||
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility4.ts(33,9): error TS2674: Constructor of class 'D' is protected and only accessible within the class declaration.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility4.ts (2 errors) ====
|
||||
class A {
|
||||
private constructor() { }
|
||||
|
||||
method() {
|
||||
class B {
|
||||
method() {
|
||||
new A(); // OK
|
||||
}
|
||||
}
|
||||
|
||||
class C extends A { // OK
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var a = new A(); // error
|
||||
~~~~~~~
|
||||
!!! error TS2673: Constructor of class 'A' is private and only accessible within the class declaration.
|
||||
|
||||
class D {
|
||||
protected constructor() { }
|
||||
|
||||
method() {
|
||||
class E {
|
||||
method() {
|
||||
new D(); // OK
|
||||
}
|
||||
}
|
||||
|
||||
class F extends D { // OK
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var d = new D(); // error
|
||||
~~~~~~~
|
||||
!!! error TS2674: Constructor of class 'D' is protected and only accessible within the class declaration.
|
|
@ -0,0 +1,33 @@
|
|||
class A {
|
||||
private constructor() { }
|
||||
|
||||
method() {
|
||||
class B {
|
||||
method() {
|
||||
new A(); // OK
|
||||
}
|
||||
}
|
||||
|
||||
class C extends A { // OK
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var a = new A(); // error
|
||||
|
||||
class D {
|
||||
protected constructor() { }
|
||||
|
||||
method() {
|
||||
class E {
|
||||
method() {
|
||||
new D(); // OK
|
||||
}
|
||||
}
|
||||
|
||||
class F extends D { // OK
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var d = new D(); // error
|
Loading…
Reference in a new issue