tests/cases/compiler/classUpdateTests.ts(34,2): error TS2377: Constructors for derived classes must contain a 'super' call. tests/cases/compiler/classUpdateTests.ts(43,18): error TS2335: 'super' can only be referenced in a derived class. tests/cases/compiler/classUpdateTests.ts(46,17): error TS2311: A class may only extend another class. tests/cases/compiler/classUpdateTests.ts(47,18): error TS2335: 'super' can only be referenced in a derived class. tests/cases/compiler/classUpdateTests.ts(57,2): error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. tests/cases/compiler/classUpdateTests.ts(63,7): error TS2415: Class 'L' incorrectly extends base class 'G'. Property 'p1' is private in type 'L' but not in type 'G'. tests/cases/compiler/classUpdateTests.ts(69,7): error TS2415: Class 'M' incorrectly extends base class 'G'. Property 'p1' is private in type 'M' but not in type 'G'. tests/cases/compiler/classUpdateTests.ts(70,2): error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. tests/cases/compiler/classUpdateTests.ts(93,3): error TS1129: Statement expected. tests/cases/compiler/classUpdateTests.ts(95,1): error TS1128: Declaration or statement expected. tests/cases/compiler/classUpdateTests.ts(99,3): error TS1129: Statement expected. tests/cases/compiler/classUpdateTests.ts(101,1): error TS1128: Declaration or statement expected. tests/cases/compiler/classUpdateTests.ts(105,3): error TS1129: Statement expected. tests/cases/compiler/classUpdateTests.ts(105,14): error TS1005: ';' expected. tests/cases/compiler/classUpdateTests.ts(107,1): error TS1128: Declaration or statement expected. tests/cases/compiler/classUpdateTests.ts(111,3): error TS1129: Statement expected. tests/cases/compiler/classUpdateTests.ts(111,15): error TS1005: ';' expected. tests/cases/compiler/classUpdateTests.ts(113,1): error TS1128: Declaration or statement expected. ==== tests/cases/compiler/classUpdateTests.ts (18 errors) ==== // // test codegen for instance properties // class A { public p1 = 0; private p2 = 0; p3; } class B { public p1 = 0; private p2 = 0; p3; constructor() {} } class C { constructor(public p1=0, private p2=0, p3=0) {} } // // test requirements for super calls // class D { // NO ERROR } class E extends D { // NO ERROR public p1 = 0; } class F extends E { constructor() {} // ERROR - super call required ~~~~~~~~~~~~~~~~ !!! error TS2377: Constructors for derived classes must contain a 'super' call. } class G extends D { public p1 = 0; constructor() { super(); } // NO ERROR } class H { constructor() { super(); } // ERROR - no super call allowed ~~~~~ !!! error TS2335: 'super' can only be referenced in a derived class. } class I extends Object { ~~~~~~ !!! error TS2311: A class may only extend another class. constructor() { super(); } // ERROR - no super call allowed ~~~~~ !!! error TS2335: 'super' can only be referenced in a derived class. } class J extends G { constructor(public p1:number) { super(); // NO ERROR } } class K extends G { constructor(public p1:number) { // ERROR ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var i = 0; ~~~~~~~~~~~~ super(); ~~~~~~~~~~ } ~~ !!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. } class L extends G { ~ !!! error TS2415: Class 'L' incorrectly extends base class 'G'. !!! error TS2415: Property 'p1' is private in type 'L' but not in type 'G'. constructor(private p1:number) { super(); // NO ERROR } } class M extends G { ~ !!! error TS2415: Class 'M' incorrectly extends base class 'G'. !!! error TS2415: Property 'p1' is private in type 'M' but not in type 'G'. constructor(private p1:number) { // ERROR ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var i = 0; ~~~~~~~~~~~~ super(); ~~~~~~~~~~ } ~~ !!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. } // // test this reference in field initializers // class N { public p1 = 0; public p2 = this.p1; constructor() { this.p2 = 0; } } // // test error on property declarations within class constructors // class O { constructor() { public p1 = 0; // ERROR ~~~~~~ !!! error TS1129: Statement expected. } } ~ !!! error TS1128: Declaration or statement expected. class P { constructor() { private p1 = 0; // ERROR ~~~~~~~ !!! error TS1129: Statement expected. } } ~ !!! error TS1128: Declaration or statement expected. class Q { constructor() { public this.p1 = 0; // ERROR ~~~~~~ !!! error TS1129: Statement expected. ~ !!! error TS1005: ';' expected. } } ~ !!! error TS1128: Declaration or statement expected. class R { constructor() { private this.p1 = 0; // ERROR ~~~~~~~ !!! error TS1129: Statement expected. ~ !!! error TS1005: ';' expected. } } ~ !!! error TS1128: Declaration or statement expected.