From 6b68b31357e1cafca7c70cfb610251b1793eccbc Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Tue, 26 Jan 2016 15:37:19 -0800 Subject: [PATCH] Update baselines --- src/compiler/diagnosticMessages.json | 2 +- .../baselines/reference/baseCheck.errors.txt | 23 +++----- tests/baselines/reference/bases.errors.txt | 4 +- ...ckSuperCallBeforeThisAccessing2.errors.txt | 4 +- ...ckSuperCallBeforeThisAccessing5.errors.txt | 4 +- ...ckSuperCallBeforeThisAccessing8.errors.txt | 4 +- .../reference/classUpdateTests.errors.txt | 18 ++++-- ...derivedClassParameterProperties.errors.txt | 58 ++++++++++++------- ...rivedClassSuperCallsWithThisArg.errors.txt | 16 ++--- .../strictModeInConstructor.errors.txt | 10 +++- .../thisInInvalidContexts.errors.txt | 13 ++--- ...InInvalidContextsExternalModule.errors.txt | 13 ++--- .../reference/thisInSuperCall.errors.txt | 20 +++---- .../reference/thisInSuperCall1.errors.txt | 9 +-- .../reference/thisInSuperCall2.errors.txt | 13 ++--- .../reference/thisInSuperCall3.errors.txt | 9 +-- 16 files changed, 104 insertions(+), 116 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index ca9ad4fd775..1300b474ff3 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2645,6 +2645,6 @@ }, "'super' must be called before accessing 'this' in the constructor of a derived class.": { "category": "Error", - "code": 17008 + "code": 17009 } } diff --git a/tests/baselines/reference/baseCheck.errors.txt b/tests/baselines/reference/baseCheck.errors.txt index 0b4e9fd61b1..c31ba95476a 100644 --- a/tests/baselines/reference/baseCheck.errors.txt +++ b/tests/baselines/reference/baseCheck.errors.txt @@ -1,18 +1,15 @@ tests/cases/compiler/baseCheck.ts(9,18): error TS2304: Cannot find name 'loc'. tests/cases/compiler/baseCheck.ts(17,53): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/compiler/baseCheck.ts(17,59): error TS2332: 'this' cannot be referenced in current location. -tests/cases/compiler/baseCheck.ts(17,59): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. -tests/cases/compiler/baseCheck.ts(18,62): error TS2332: 'this' cannot be referenced in current location. -tests/cases/compiler/baseCheck.ts(18,62): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/baseCheck.ts(17,59): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/baseCheck.ts(18,62): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. tests/cases/compiler/baseCheck.ts(19,59): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -tests/cases/compiler/baseCheck.ts(19,68): error TS2332: 'this' cannot be referenced in current location. -tests/cases/compiler/baseCheck.ts(19,68): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/baseCheck.ts(19,68): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. tests/cases/compiler/baseCheck.ts(22,9): error TS2304: Cannot find name 'x'. tests/cases/compiler/baseCheck.ts(23,7): error TS2304: Cannot find name 'x'. tests/cases/compiler/baseCheck.ts(26,9): error TS2304: Cannot find name 'x'. -==== tests/cases/compiler/baseCheck.ts (12 errors) ==== +==== tests/cases/compiler/baseCheck.ts (9 errors) ==== class C { constructor(x: number, y: number) { } } class ELoc extends C { constructor(x: number) { @@ -35,21 +32,15 @@ tests/cases/compiler/baseCheck.ts(26,9): error TS2304: Cannot find name 'x'. ~~~~~~~~~~~~~ !!! error TS2346: Supplied parameters do not match any signature of call target. ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. - ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. class E extends C { constructor(public z: number) { super(0, this.z) } } ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. - ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. class F extends C { constructor(public z: number) { super("hello", this.z) } } // first param type ~~~~~~~ !!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. - ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. function f() { if (x<10) { diff --git a/tests/baselines/reference/bases.errors.txt b/tests/baselines/reference/bases.errors.txt index 7c48c977b2d..a61d35f664e 100644 --- a/tests/baselines/reference/bases.errors.txt +++ b/tests/baselines/reference/bases.errors.txt @@ -4,7 +4,7 @@ tests/cases/compiler/bases.ts(7,17): error TS2304: Cannot find name 'any'. tests/cases/compiler/bases.ts(11,7): error TS2420: Class 'C' incorrectly implements interface 'I'. Property 'x' is missing in type 'C'. tests/cases/compiler/bases.ts(12,5): error TS2377: Constructors for derived classes must contain a 'super' call. -tests/cases/compiler/bases.ts(13,9): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/bases.ts(13,9): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. tests/cases/compiler/bases.ts(13,14): error TS2339: Property 'x' does not exist on type 'C'. tests/cases/compiler/bases.ts(13,15): error TS1005: ';' expected. tests/cases/compiler/bases.ts(13,17): error TS2304: Cannot find name 'any'. @@ -38,7 +38,7 @@ tests/cases/compiler/bases.ts(18,9): error TS2339: Property 'y' does not exist o this.x: any; ~~~~~~~~~~~~~~~~~~~~ ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. ~ !!! error TS2339: Property 'x' does not exist on type 'C'. ~ diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.errors.txt b/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.errors.txt index c8aa356fd4f..4e947e8630f 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.errors.txt +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/checkSuperCallBeforeThisAccessing2.ts(5,9): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/checkSuperCallBeforeThisAccessing2.ts(5,9): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. ==== tests/cases/compiler/checkSuperCallBeforeThisAccessing2.ts (1 errors) ==== @@ -8,7 +8,7 @@ tests/cases/compiler/checkSuperCallBeforeThisAccessing2.ts(5,9): error TS17008: constructor() { this.x = 100; ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. super(); this.x = 10; var that = this; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.errors.txt b/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.errors.txt index 8ffed5961a3..a0b86e28cf0 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.errors.txt +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/checkSuperCallBeforeThisAccessing5.ts(5,15): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/checkSuperCallBeforeThisAccessing5.ts(5,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. ==== tests/cases/compiler/checkSuperCallBeforeThisAccessing5.ts (1 errors) ==== @@ -8,6 +8,6 @@ tests/cases/compiler/checkSuperCallBeforeThisAccessing5.ts(5,15): error TS17008: constructor() { super(this.x); ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } \ No newline at end of file diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.errors.txt b/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.errors.txt index 2b37f740331..2c8c8d9fb06 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.errors.txt +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/checkSuperCallBeforeThisAccessing8.ts(7,20): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/checkSuperCallBeforeThisAccessing8.ts(7,20): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. ==== tests/cases/compiler/checkSuperCallBeforeThisAccessing8.ts (1 errors) ==== @@ -10,7 +10,7 @@ tests/cases/compiler/checkSuperCallBeforeThisAccessing8.ts(7,20): error TS17008: constructor() { var that = this; ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. super(); } } \ No newline at end of file diff --git a/tests/baselines/reference/classUpdateTests.errors.txt b/tests/baselines/reference/classUpdateTests.errors.txt index 55965756410..59e9bc9ced1 100644 --- a/tests/baselines/reference/classUpdateTests.errors.txt +++ b/tests/baselines/reference/classUpdateTests.errors.txt @@ -1,11 +1,11 @@ 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(59,3): 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(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(72,3): 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(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 TS1128: Declaration or statement expected. tests/cases/compiler/classUpdateTests.ts(95,1): error TS1128: Declaration or statement expected. tests/cases/compiler/classUpdateTests.ts(99,3): error TS1128: Declaration or statement expected. @@ -80,11 +80,14 @@ tests/cases/compiler/classUpdateTests.ts(113,1): error TS1128: Declaration or st 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. + ~~~~~~~~~~ } + ~~ +!!! 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 { @@ -101,11 +104,14 @@ tests/cases/compiler/classUpdateTests.ts(113,1): error TS1128: Declaration or st !!! 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. + ~~~~~~~~~~ } + ~~ +!!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. } // diff --git a/tests/baselines/reference/derivedClassParameterProperties.errors.txt b/tests/baselines/reference/derivedClassParameterProperties.errors.txt index c54ef2a02b7..27bb9af63a1 100644 --- a/tests/baselines/reference/derivedClassParameterProperties.errors.txt +++ b/tests/baselines/reference/derivedClassParameterProperties.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(17,9): 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/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(32,9): 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/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(47,9): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(57,9): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(58,9): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(59,9): 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/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(80,9): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(81,9): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(82,9): 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/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(15,5): 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/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(30,5): 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/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(47,9): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(56,5): 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/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(57,9): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(58,9): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(79,5): 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/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(80,9): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(81,9): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. ==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts (9 errors) ==== @@ -25,11 +25,14 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassP class Derived2 extends Base { constructor(public y: string) { + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var a = 1; + ~~~~~~~~~~~~~~~~~~ super(); // error - ~~~~~~~~ -!!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. + ~~~~~~~~~~~~~~~~~~~~~~~~~ } + ~~~~~ +!!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. } class Derived3 extends Base { @@ -42,11 +45,14 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassP class Derived4 extends Base { a = 1; constructor(y: string) { + ~~~~~~~~~~~~~~~~~~~~~~~~ var b = 2; + ~~~~~~~~~~~~~~~~~~ super(); // error - ~~~~~~~~ -!!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. + ~~~~~~~~~~~~~~~~~~~~~~~~~ } + ~~~~~ +!!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. } class Derived5 extends Base { @@ -62,7 +68,7 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassP constructor(y: string) { this.a = 1; ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. var b = 2; super(); // error: "super" has to be called before "this" accessing } @@ -72,16 +78,20 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassP a = 1; b: number; constructor(y: string) { + ~~~~~~~~~~~~~~~~~~~~~~~~ this.a = 3; + ~~~~~~~~~~~~~~~~~~~ ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. this.b = 3; + ~~~~~~~~~~~~~~~~~~~ ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. super(); // error - ~~~~~~~~ -!!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. + ~~~~~~~~~~~~~~~~~~~~~~~~~ } + ~~~~~ +!!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. } class Derived8 extends Base { @@ -101,16 +111,20 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassP a = 1; b: number; constructor(y: string) { + ~~~~~~~~~~~~~~~~~~~~~~~~ this.a = 3; + ~~~~~~~~~~~~~~~~~~~ ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. this.b = 3; + ~~~~~~~~~~~~~~~~~~~ ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. super(); // error - ~~~~~~~~ -!!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. + ~~~~~~~~~~~~~~~~~~~~~~~~~ } + ~~~~~ +!!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. } class Derived10 extends Base2 { diff --git a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.errors.txt b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.errors.txt index 7439c81be85..d381eff17dc 100644 --- a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.errors.txt +++ b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.errors.txt @@ -1,10 +1,8 @@ -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts(8,15): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts(14,15): error TS2332: 'this' cannot be referenced in current location. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts(14,15): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. -tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts(20,21): error TS2332: 'this' cannot be referenced in current location. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts(8,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts(14,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. -==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts (4 errors) ==== +==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts (2 errors) ==== class Base { x: string; constructor(a) { } @@ -14,7 +12,7 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassS constructor() { super(this); // ok ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } @@ -22,17 +20,13 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassS constructor(public a: string) { super(this); // error ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. - ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } class Derived3 extends Base { constructor(public a: string) { super(() => this); // error - ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. } } diff --git a/tests/baselines/reference/strictModeInConstructor.errors.txt b/tests/baselines/reference/strictModeInConstructor.errors.txt index 3c38530cc12..9a80732842a 100644 --- a/tests/baselines/reference/strictModeInConstructor.errors.txt +++ b/tests/baselines/reference/strictModeInConstructor.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/strictModeInConstructor.ts(29,9): 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/strictModeInConstructor.ts(27,5): 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/strictModeInConstructor.ts (1 errors) ==== @@ -29,12 +29,16 @@ tests/cases/compiler/strictModeInConstructor.ts(29,9): error TS2376: A 'super' c public s: number = 9; constructor () { + ~~~~~~~~~~~~~~~~ var x = 1; // Error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ super(); - ~~~~~~~~ -!!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. + ~~~~~~~~~~~~~~~~ "use strict"; + ~~~~~~~~~~~~~~~~~~~~~ } + ~~~~~ +!!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties. } class Bs extends A { diff --git a/tests/baselines/reference/thisInInvalidContexts.errors.txt b/tests/baselines/reference/thisInInvalidContexts.errors.txt index ccf6a015bd9..d33260fa108 100644 --- a/tests/baselines/reference/thisInInvalidContexts.errors.txt +++ b/tests/baselines/reference/thisInInvalidContexts.errors.txt @@ -1,7 +1,6 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(3,16): error TS2334: 'this' cannot be referenced in a static property initializer. -tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(14,15): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. -tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(22,15): error TS2332: 'this' cannot be referenced in current location. -tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(22,15): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(14,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(22,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(28,13): error TS2331: 'this' cannot be referenced in a module or namespace body. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(36,13): error TS2526: A 'this' type is available only in a non-static member of a class or interface. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(38,25): error TS2507: Type 'any' is not a constructor function type. @@ -9,7 +8,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(44,9): tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(45,9): error TS2332: 'this' cannot be referenced in current location. -==== tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts (9 errors) ==== +==== tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts (8 errors) ==== //'this' in static member initializer class ErrClass1 { static t = this; // Error @@ -27,7 +26,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(45,9): constructor() { super(this); // Error ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } @@ -37,9 +36,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(45,9): constructor() { super(this); // Error ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. - ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } diff --git a/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt b/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt index bc671b2fdbe..6c1a257b5ea 100644 --- a/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt +++ b/tests/baselines/reference/thisInInvalidContextsExternalModule.errors.txt @@ -1,7 +1,6 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(3,16): error TS2334: 'this' cannot be referenced in a static property initializer. -tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(14,15): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. -tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(22,15): error TS2332: 'this' cannot be referenced in current location. -tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(22,15): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(14,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(22,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(28,13): error TS2331: 'this' cannot be referenced in a module or namespace body. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(36,13): error TS2526: A 'this' type is available only in a non-static member of a class or interface. tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(38,25): error TS2507: Type 'any' is not a constructor function type. @@ -10,7 +9,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalMod tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(48,1): error TS1148: Cannot compile modules unless the '--module' flag is provided. Consider setting the 'module' compiler option in a 'tsconfig.json' file. -==== tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts (10 errors) ==== +==== tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts (9 errors) ==== //'this' in static member initializer class ErrClass1 { static t = this; // Error @@ -28,7 +27,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalMod constructor() { super(this); // error: "super" has to be called before "this" accessing ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } @@ -38,9 +37,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalMod constructor() { super(this); // Error ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. - ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } diff --git a/tests/baselines/reference/thisInSuperCall.errors.txt b/tests/baselines/reference/thisInSuperCall.errors.txt index 000c2074892..d1eeb1d2b2b 100644 --- a/tests/baselines/reference/thisInSuperCall.errors.txt +++ b/tests/baselines/reference/thisInSuperCall.errors.txt @@ -1,11 +1,9 @@ -tests/cases/compiler/thisInSuperCall.ts(7,15): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. -tests/cases/compiler/thisInSuperCall.ts(14,15): error TS2332: 'this' cannot be referenced in current location. -tests/cases/compiler/thisInSuperCall.ts(14,15): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. -tests/cases/compiler/thisInSuperCall.ts(20,15): error TS2332: 'this' cannot be referenced in current location. -tests/cases/compiler/thisInSuperCall.ts(20,15): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/thisInSuperCall.ts(7,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/thisInSuperCall.ts(14,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/thisInSuperCall.ts(20,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. -==== tests/cases/compiler/thisInSuperCall.ts (5 errors) ==== +==== tests/cases/compiler/thisInSuperCall.ts (3 errors) ==== class Base { constructor(x: any) {} } @@ -14,7 +12,7 @@ tests/cases/compiler/thisInSuperCall.ts(20,15): error TS17008: 'super' must be c constructor() { super(this); // error: "super" has to be called before "this" accessing ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } @@ -23,9 +21,7 @@ tests/cases/compiler/thisInSuperCall.ts(20,15): error TS17008: 'super' must be c constructor() { super(this); // error ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. - ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } @@ -33,8 +29,6 @@ tests/cases/compiler/thisInSuperCall.ts(20,15): error TS17008: 'super' must be c constructor(public p) { super(this); // error ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. - ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } \ No newline at end of file diff --git a/tests/baselines/reference/thisInSuperCall1.errors.txt b/tests/baselines/reference/thisInSuperCall1.errors.txt index 98d8ee123ae..20bc502ab79 100644 --- a/tests/baselines/reference/thisInSuperCall1.errors.txt +++ b/tests/baselines/reference/thisInSuperCall1.errors.txt @@ -1,8 +1,7 @@ -tests/cases/compiler/thisInSuperCall1.ts(7,15): error TS2332: 'this' cannot be referenced in current location. -tests/cases/compiler/thisInSuperCall1.ts(7,15): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/thisInSuperCall1.ts(7,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. -==== tests/cases/compiler/thisInSuperCall1.ts (2 errors) ==== +==== tests/cases/compiler/thisInSuperCall1.ts (1 errors) ==== class Base { constructor(a: any) {} } @@ -11,9 +10,7 @@ tests/cases/compiler/thisInSuperCall1.ts(7,15): error TS17008: 'super' must be c constructor(public x: number) { super(this); ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. - ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } \ No newline at end of file diff --git a/tests/baselines/reference/thisInSuperCall2.errors.txt b/tests/baselines/reference/thisInSuperCall2.errors.txt index 4047bcb9a06..4e4e9b50a8e 100644 --- a/tests/baselines/reference/thisInSuperCall2.errors.txt +++ b/tests/baselines/reference/thisInSuperCall2.errors.txt @@ -1,9 +1,8 @@ -tests/cases/compiler/thisInSuperCall2.ts(8,15): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. -tests/cases/compiler/thisInSuperCall2.ts(16,15): error TS2332: 'this' cannot be referenced in current location. -tests/cases/compiler/thisInSuperCall2.ts(16,15): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/thisInSuperCall2.ts(8,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/thisInSuperCall2.ts(16,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. -==== tests/cases/compiler/thisInSuperCall2.ts (3 errors) ==== +==== tests/cases/compiler/thisInSuperCall2.ts (2 errors) ==== class Base { constructor(a: any) {} } @@ -13,7 +12,7 @@ tests/cases/compiler/thisInSuperCall2.ts(16,15): error TS17008: 'super' must be constructor() { super(this); // error: "super" has to be called before "this" accessing ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } @@ -23,9 +22,7 @@ tests/cases/compiler/thisInSuperCall2.ts(16,15): error TS17008: 'super' must be constructor() { super(this); // error ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. - ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } \ No newline at end of file diff --git a/tests/baselines/reference/thisInSuperCall3.errors.txt b/tests/baselines/reference/thisInSuperCall3.errors.txt index 0e7d1575096..27a7dc8b25d 100644 --- a/tests/baselines/reference/thisInSuperCall3.errors.txt +++ b/tests/baselines/reference/thisInSuperCall3.errors.txt @@ -1,8 +1,7 @@ -tests/cases/compiler/thisInSuperCall3.ts(9,15): error TS2332: 'this' cannot be referenced in current location. -tests/cases/compiler/thisInSuperCall3.ts(9,15): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +tests/cases/compiler/thisInSuperCall3.ts(9,15): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. -==== tests/cases/compiler/thisInSuperCall3.ts (2 errors) ==== +==== tests/cases/compiler/thisInSuperCall3.ts (1 errors) ==== class Base { constructor(a: any) {} } @@ -13,9 +12,7 @@ tests/cases/compiler/thisInSuperCall3.ts(9,15): error TS17008: 'super' must be c constructor() { super(this); ~~~~ -!!! error TS2332: 'this' cannot be referenced in current location. - ~~~~ -!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class. +!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class. } } \ No newline at end of file