Update baseline with new error message number and fix space and comment

This commit is contained in:
Yui T 2015-11-30 10:30:03 -08:00 committed by Kanchalai Tanglertsampan
parent ab8d0cec54
commit d89b9df567
15 changed files with 44 additions and 45 deletions

View File

@ -7240,7 +7240,6 @@ namespace ts {
let container = getThisContainer(node, /* includeArrowFunctions */ true);
let needToCaptureLexicalThis = false;
if (container.kind === SyntaxKind.Constructor) {
// Keep track of whether we have seen "super" before encounter "this" so that
// we can report appropriate error later in checkConstructorDeclaration
@ -7251,7 +7250,7 @@ namespace ts {
// (()=>this); // No Error
// super();
// }
let nodeLinks = getNodeLinks(container);
const nodeLinks = getNodeLinks(container);
nodeLinks.flags |= NodeCheckFlags.HasSeenThisCall;
}
@ -10199,10 +10198,10 @@ namespace ts {
const signature = getResolvedSignature(node);
if (node.expression.kind === SyntaxKind.SuperKeyword) {
let containgFunction = getContainingFunction(node.expression);
const containgFunction = getContainingFunction(node.expression);
if (containgFunction && containgFunction.kind === SyntaxKind.Constructor) {
let nodeLinks = getNodeLinks(containgFunction);
const nodeLinks = getNodeLinks(containgFunction);
if (!(nodeLinks.flags & NodeCheckFlags.HasSeenThisCall)) {
nodeLinks.flags |= NodeCheckFlags.HasSeenSuperBeforeThis;
}
@ -11835,7 +11834,7 @@ namespace ts {
markThisReferencesAsErrors(superCallStatement.expression);
}
}
else if (!(getNodeCheckFlags(node) & NodeCheckFlags.HasSeenSuperBeforeThis)){
else if (!(getNodeCheckFlags(node) & NodeCheckFlags.HasSeenSuperBeforeThis)) {
// In ES6, super inside constructor of class-declaration has to precede "this" accessing
error(superCallStatement, Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class);
}

View File

@ -15,17 +15,17 @@ class Derived extends Based {
>super : typeof Based
this;
>this : Derived
>this : this
this.x = 10;
>this.x = 10 : number
>this.x : number
>this : Derived
>this : this
>x : number
>10 : number
var that = this;
>that : Derived
>this : Derived
>that : this
>this : this
}
}

View File

@ -1,4 +1,4 @@
tests/cases/compiler/checkSuperCallBeforeThisAccessing2.ts(6,9): error TS17006: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/checkSuperCallBeforeThisAccessing2.ts(6,9): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class.
==== tests/cases/compiler/checkSuperCallBeforeThisAccessing2.ts (1 errors) ====
@ -9,7 +9,7 @@ tests/cases/compiler/checkSuperCallBeforeThisAccessing2.ts(6,9): error TS17006:
this.x = 100;
super();
~~~~~~~~
!!! error TS17006: 'super' must be called before accessing 'this' in the constructor of a derived class.
!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class.
this.x = 10;
var that = this;
}

View File

@ -20,7 +20,7 @@ class Derived extends Based {
this.y = true;
>this.y = true : boolean
>this.y : boolean
>this : innver
>this : this
>y : boolean
>true : boolean
}
@ -32,12 +32,12 @@ class Derived extends Based {
this.x = 10;
>this.x = 10 : number
>this.x : number
>this : Derived
>this : this
>x : number
>10 : number
var that = this;
>that : Derived
>this : Derived
>that : this
>this : this
}
}

View File

@ -15,14 +15,14 @@ class Derived extends Based {
>() => { this; // No error } : () => void
this; // No error
>this : Derived
>this : this
});
() => {
>() => { this; // No error } : () => void
this; // No error
>this : Derived
>this : this
};
(() => {
@ -31,7 +31,7 @@ class Derived extends Based {
>() => { this; // No error } : () => void
this; // No error
>this : Derived
>this : this
})();
super();
@ -45,12 +45,12 @@ class Derived extends Based {
this.x = 10;
>this.x = 10 : number
>this.x : number
>this : Derived
>this : this
>x : number
>10 : number
var that = this;
>that : Derived
>this : Derived
>that : this
>this : this
}
}

View File

@ -1,4 +1,4 @@
tests/cases/compiler/checkSuperCallBeforeThisAccessing5.ts(5,9): error TS17006: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/checkSuperCallBeforeThisAccessing5.ts(5,9): error TS17008: '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,9): error TS17006:
constructor() {
super(this.x);
~~~~~~~~~~~~~~
!!! error TS17006: 'super' must be called before accessing 'this' in the constructor of a derived class.
!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class.
}
}

View File

@ -12,9 +12,9 @@ class Super extends Base {
constructor() {
(() => this); // No Error
>(() => this) : () => Super
>() => this : () => Super
>this : Super
>(() => this) : () => this
>() => this : () => this
>this : this
super();
>super() : void

View File

@ -15,8 +15,8 @@ class Super extends Base {
super((() => this)); // No error
>super((() => this)) : void
>super : typeof Base
>(() => this) : () => Super
>() => this : () => Super
>this : Super
>(() => this) : () => this
>() => this : () => this
>this : this
}
}

View File

@ -1,4 +1,4 @@
tests/cases/compiler/checkSuperCallBeforeThisAccessing8.ts(8,9): error TS17006: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/checkSuperCallBeforeThisAccessing8.ts(8,9): error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class.
==== tests/cases/compiler/checkSuperCallBeforeThisAccessing8.ts (1 errors) ====
@ -11,6 +11,6 @@ tests/cases/compiler/checkSuperCallBeforeThisAccessing8.ts(8,9): error TS17006:
var that = this;
super();
~~~~~~~~
!!! error TS17006: 'super' must be called before accessing 'this' in the constructor of a derived class.
!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class.
}
}

View File

@ -1,6 +1,6 @@
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(49,9): error TS17006: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts(49,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(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.
@ -60,7 +60,7 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassP
var b = 2;
super(); // error: "super" has to be called before "this" accessing
~~~~~~~~
!!! error TS17006: 'super' must be called before accessing 'this' in the constructor of a derived class.
!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class.
}
}

View File

@ -1,4 +1,4 @@
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts(8,9): error TS17006: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts(8,9): 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(20,21): error TS2332: 'this' cannot be referenced in current location.
@ -13,7 +13,7 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassS
constructor() {
super(this); // ok
~~~~~~~~~~~~
!!! error TS17006: 'super' must be called before accessing 'this' in the constructor of a derived class.
!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class.
}
}

View File

@ -1,5 +1,5 @@
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,9): error TS17006: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(14,9): 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(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.
@ -8,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 (7 errors) ====
==== tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts (8 errors) ====
//'this' in static member initializer
class ErrClass1 {
static t = this; // Error
@ -26,7 +26,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(45,9):
constructor() {
super(this); // Error
~~~~~~~~~~~~
!!! error TS17006: 'super' must be called before accessing 'this' in the constructor of a derived class.
!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class.
}
}

View File

@ -1,5 +1,5 @@
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,9): error TS17006: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts(14,9): 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(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.
@ -9,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 (8 errors) ====
==== tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalModule.ts (9 errors) ====
//'this' in static member initializer
class ErrClass1 {
static t = this; // Error
@ -27,7 +27,7 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalMod
constructor() {
super(this); // error: "super" has to be called before "this" accessing
~~~~~~~~~~~~
!!! error TS17006: 'super' must be called before accessing 'this' in the constructor of a derived class.
!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class.
}
}

View File

@ -1,4 +1,4 @@
tests/cases/compiler/thisInSuperCall.ts(7,9): error TS17006: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/thisInSuperCall.ts(7,9): 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(20,15): error TS2332: 'this' cannot be referenced in current location.
@ -12,7 +12,7 @@ tests/cases/compiler/thisInSuperCall.ts(20,15): error TS2332: 'this' cannot be r
constructor() {
super(this); // error: "super" has to be called before "this" accessing
~~~~~~~~~~~~
!!! error TS17006: 'super' must be called before accessing 'this' in the constructor of a derived class.
!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class.
}
}

View File

@ -1,4 +1,4 @@
tests/cases/compiler/thisInSuperCall2.ts(8,9): error TS17006: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/thisInSuperCall2.ts(8,9): 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.
@ -12,7 +12,7 @@ tests/cases/compiler/thisInSuperCall2.ts(16,15): error TS2332: 'this' cannot be
constructor() {
super(this); // error: "super" has to be called before "this" accessing
~~~~~~~~~~~~
!!! error TS17006: 'super' must be called before accessing 'this' in the constructor of a derived class.
!!! error TS17008: 'super' must be called before accessing 'this' in the constructor of a derived class.
}
}