2014-09-12 22:35:07 +02:00
|
|
|
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(6,5): error TS1089: 'private' modifier cannot appear on a constructor declaration.
|
2014-09-19 23:01:07 +02:00
|
|
|
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(10,5): error TS1089: 'protected' modifier cannot appear on a constructor declaration.
|
|
|
|
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(23,9): error TS1089: 'private' modifier cannot appear on a constructor declaration.
|
|
|
|
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(27,9): error TS1089: 'protected' modifier cannot appear on a constructor declaration.
|
2014-09-12 22:35:07 +02:00
|
|
|
|
|
|
|
|
2014-09-19 23:01:07 +02:00
|
|
|
==== tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts (4 errors) ====
|
2014-07-13 01:04:16 +02:00
|
|
|
class C {
|
|
|
|
public constructor(public x: number) { }
|
|
|
|
}
|
|
|
|
|
|
|
|
class D {
|
|
|
|
private constructor(public x: number) { } // error
|
|
|
|
~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS1089: 'private' modifier cannot appear on a constructor declaration.
|
2014-07-13 01:04:16 +02:00
|
|
|
}
|
|
|
|
|
2014-09-19 23:01:07 +02:00
|
|
|
class E {
|
|
|
|
protected constructor(public x: number) { } // error
|
|
|
|
~~~~~~~~~
|
|
|
|
!!! error TS1089: 'protected' modifier cannot appear on a constructor declaration.
|
|
|
|
}
|
|
|
|
|
2014-07-13 01:04:16 +02:00
|
|
|
var c = new C(1);
|
|
|
|
var d = new D(1);
|
2014-09-19 23:01:07 +02:00
|
|
|
var e = new E(1);
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
module Generic {
|
|
|
|
class C<T> {
|
|
|
|
public constructor(public x: T) { }
|
|
|
|
}
|
|
|
|
|
|
|
|
class D<T> {
|
|
|
|
private constructor(public x: T) { } // error
|
|
|
|
~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS1089: 'private' modifier cannot appear on a constructor declaration.
|
2014-07-13 01:04:16 +02:00
|
|
|
}
|
|
|
|
|
2014-09-19 23:01:07 +02:00
|
|
|
class E<T> {
|
|
|
|
protected constructor(public x: T) { } // error
|
|
|
|
~~~~~~~~~
|
|
|
|
!!! error TS1089: 'protected' modifier cannot appear on a constructor declaration.
|
|
|
|
}
|
|
|
|
|
2014-07-13 01:04:16 +02:00
|
|
|
var c = new C(1);
|
|
|
|
var d = new D(1);
|
2014-09-19 23:01:07 +02:00
|
|
|
var e = new E(1);
|
2014-07-13 01:04:16 +02:00
|
|
|
}
|
|
|
|
|