Update baselines
This commit is contained in:
parent
eaa2846348
commit
c2fb694404
|
@ -0,0 +1,33 @@
|
|||
//// [checkSuperCallBeforeThisAccessing1.ts]
|
||||
class Based { }
|
||||
class Derived extends Based {
|
||||
public x: number;
|
||||
constructor() {
|
||||
super();
|
||||
this;
|
||||
this.x = 10;
|
||||
var that = this;
|
||||
}
|
||||
}
|
||||
|
||||
//// [checkSuperCallBeforeThisAccessing1.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Based = (function () {
|
||||
function Based() {
|
||||
}
|
||||
return Based;
|
||||
})();
|
||||
var Derived = (function (_super) {
|
||||
__extends(Derived, _super);
|
||||
function Derived() {
|
||||
_super.call(this);
|
||||
this;
|
||||
this.x = 10;
|
||||
var that = this;
|
||||
}
|
||||
return Derived;
|
||||
})(Based);
|
|
@ -0,0 +1,28 @@
|
|||
=== tests/cases/compiler/checkSuperCallBeforeThisAccessing1.ts ===
|
||||
class Based { }
|
||||
>Based : Symbol(Based, Decl(checkSuperCallBeforeThisAccessing1.ts, 0, 0))
|
||||
|
||||
class Derived extends Based {
|
||||
>Derived : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing1.ts, 0, 15))
|
||||
>Based : Symbol(Based, Decl(checkSuperCallBeforeThisAccessing1.ts, 0, 0))
|
||||
|
||||
public x: number;
|
||||
>x : Symbol(x, Decl(checkSuperCallBeforeThisAccessing1.ts, 1, 29))
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
>super : Symbol(Based, Decl(checkSuperCallBeforeThisAccessing1.ts, 0, 0))
|
||||
|
||||
this;
|
||||
>this : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing1.ts, 0, 15))
|
||||
|
||||
this.x = 10;
|
||||
>this.x : Symbol(x, Decl(checkSuperCallBeforeThisAccessing1.ts, 1, 29))
|
||||
>this : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing1.ts, 0, 15))
|
||||
>x : Symbol(x, Decl(checkSuperCallBeforeThisAccessing1.ts, 1, 29))
|
||||
|
||||
var that = this;
|
||||
>that : Symbol(that, Decl(checkSuperCallBeforeThisAccessing1.ts, 7, 11))
|
||||
>this : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing1.ts, 0, 15))
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
=== tests/cases/compiler/checkSuperCallBeforeThisAccessing1.ts ===
|
||||
class Based { }
|
||||
>Based : Based
|
||||
|
||||
class Derived extends Based {
|
||||
>Derived : Derived
|
||||
>Based : Based
|
||||
|
||||
public x: number;
|
||||
>x : number
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
>super() : void
|
||||
>super : typeof Based
|
||||
|
||||
this;
|
||||
>this : Derived
|
||||
|
||||
this.x = 10;
|
||||
>this.x = 10 : number
|
||||
>this.x : number
|
||||
>this : Derived
|
||||
>x : number
|
||||
>10 : number
|
||||
|
||||
var that = this;
|
||||
>that : Derived
|
||||
>this : Derived
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
tests/cases/compiler/checkSuperCallBeforeThisAccessing2.ts(6,9): error TS17006: 'super' has to be called before 'this' accessing.
|
||||
|
||||
|
||||
==== tests/cases/compiler/checkSuperCallBeforeThisAccessing2.ts (1 errors) ====
|
||||
class Based { }
|
||||
class Derived extends Based {
|
||||
public x: number;
|
||||
constructor() {
|
||||
this.x = 100;
|
||||
super();
|
||||
~~~~~~~~
|
||||
!!! error TS17006: 'super' has to be called before 'this' accessing.
|
||||
this.x = 10;
|
||||
var that = this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
//// [checkSuperCallBeforeThisAccessing2.ts]
|
||||
class Based { }
|
||||
class Derived extends Based {
|
||||
public x: number;
|
||||
constructor() {
|
||||
this.x = 100;
|
||||
super();
|
||||
this.x = 10;
|
||||
var that = this;
|
||||
}
|
||||
}
|
||||
|
||||
//// [checkSuperCallBeforeThisAccessing2.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Based = (function () {
|
||||
function Based() {
|
||||
}
|
||||
return Based;
|
||||
})();
|
||||
var Derived = (function (_super) {
|
||||
__extends(Derived, _super);
|
||||
function Derived() {
|
||||
this.x = 100;
|
||||
_super.call(this);
|
||||
this.x = 10;
|
||||
var that = this;
|
||||
}
|
||||
return Derived;
|
||||
})(Based);
|
|
@ -0,0 +1,43 @@
|
|||
//// [checkSuperCallBeforeThisAccessing3.ts]
|
||||
class Based { }
|
||||
class Derived extends Based {
|
||||
public x: number;
|
||||
constructor() {
|
||||
class innver {
|
||||
public y: boolean;
|
||||
constructor() {
|
||||
this.y = true;
|
||||
}
|
||||
}
|
||||
super();
|
||||
this.x = 10;
|
||||
var that = this;
|
||||
}
|
||||
}
|
||||
|
||||
//// [checkSuperCallBeforeThisAccessing3.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Based = (function () {
|
||||
function Based() {
|
||||
}
|
||||
return Based;
|
||||
})();
|
||||
var Derived = (function (_super) {
|
||||
__extends(Derived, _super);
|
||||
function Derived() {
|
||||
var innver = (function () {
|
||||
function innver() {
|
||||
this.y = true;
|
||||
}
|
||||
return innver;
|
||||
})();
|
||||
_super.call(this);
|
||||
this.x = 10;
|
||||
var that = this;
|
||||
}
|
||||
return Derived;
|
||||
})(Based);
|
|
@ -0,0 +1,38 @@
|
|||
=== tests/cases/compiler/checkSuperCallBeforeThisAccessing3.ts ===
|
||||
class Based { }
|
||||
>Based : Symbol(Based, Decl(checkSuperCallBeforeThisAccessing3.ts, 0, 0))
|
||||
|
||||
class Derived extends Based {
|
||||
>Derived : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing3.ts, 0, 15))
|
||||
>Based : Symbol(Based, Decl(checkSuperCallBeforeThisAccessing3.ts, 0, 0))
|
||||
|
||||
public x: number;
|
||||
>x : Symbol(x, Decl(checkSuperCallBeforeThisAccessing3.ts, 1, 29))
|
||||
|
||||
constructor() {
|
||||
class innver {
|
||||
>innver : Symbol(innver, Decl(checkSuperCallBeforeThisAccessing3.ts, 3, 19))
|
||||
|
||||
public y: boolean;
|
||||
>y : Symbol(y, Decl(checkSuperCallBeforeThisAccessing3.ts, 4, 22))
|
||||
|
||||
constructor() {
|
||||
this.y = true;
|
||||
>this.y : Symbol(y, Decl(checkSuperCallBeforeThisAccessing3.ts, 4, 22))
|
||||
>this : Symbol(innver, Decl(checkSuperCallBeforeThisAccessing3.ts, 3, 19))
|
||||
>y : Symbol(y, Decl(checkSuperCallBeforeThisAccessing3.ts, 4, 22))
|
||||
}
|
||||
}
|
||||
super();
|
||||
>super : Symbol(Based, Decl(checkSuperCallBeforeThisAccessing3.ts, 0, 0))
|
||||
|
||||
this.x = 10;
|
||||
>this.x : Symbol(x, Decl(checkSuperCallBeforeThisAccessing3.ts, 1, 29))
|
||||
>this : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing3.ts, 0, 15))
|
||||
>x : Symbol(x, Decl(checkSuperCallBeforeThisAccessing3.ts, 1, 29))
|
||||
|
||||
var that = this;
|
||||
>that : Symbol(that, Decl(checkSuperCallBeforeThisAccessing3.ts, 12, 11))
|
||||
>this : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing3.ts, 0, 15))
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
=== tests/cases/compiler/checkSuperCallBeforeThisAccessing3.ts ===
|
||||
class Based { }
|
||||
>Based : Based
|
||||
|
||||
class Derived extends Based {
|
||||
>Derived : Derived
|
||||
>Based : Based
|
||||
|
||||
public x: number;
|
||||
>x : number
|
||||
|
||||
constructor() {
|
||||
class innver {
|
||||
>innver : innver
|
||||
|
||||
public y: boolean;
|
||||
>y : boolean
|
||||
|
||||
constructor() {
|
||||
this.y = true;
|
||||
>this.y = true : boolean
|
||||
>this.y : boolean
|
||||
>this : innver
|
||||
>y : boolean
|
||||
>true : boolean
|
||||
}
|
||||
}
|
||||
super();
|
||||
>super() : void
|
||||
>super : typeof Based
|
||||
|
||||
this.x = 10;
|
||||
>this.x = 10 : number
|
||||
>this.x : number
|
||||
>this : Derived
|
||||
>x : number
|
||||
>10 : number
|
||||
|
||||
var that = this;
|
||||
>that : Derived
|
||||
>this : Derived
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
//// [checkSuperCallBeforeThisAccessing4.ts]
|
||||
class Based { }
|
||||
class Derived extends Based {
|
||||
public x: number;
|
||||
constructor() {
|
||||
(() => {
|
||||
this; // No error
|
||||
});
|
||||
() => {
|
||||
this; // No error
|
||||
};
|
||||
(() => {
|
||||
this; // No error
|
||||
})();
|
||||
super();
|
||||
super();
|
||||
this.x = 10;
|
||||
var that = this;
|
||||
}
|
||||
}
|
||||
|
||||
//// [checkSuperCallBeforeThisAccessing4.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Based = (function () {
|
||||
function Based() {
|
||||
}
|
||||
return Based;
|
||||
})();
|
||||
var Derived = (function (_super) {
|
||||
__extends(Derived, _super);
|
||||
function Derived() {
|
||||
var _this = this;
|
||||
(function () {
|
||||
_this; // No error
|
||||
});
|
||||
(function () {
|
||||
_this; // No error
|
||||
});
|
||||
(function () {
|
||||
_this; // No error
|
||||
})();
|
||||
_super.call(this);
|
||||
_super.call(this);
|
||||
this.x = 10;
|
||||
var that = this;
|
||||
}
|
||||
return Derived;
|
||||
})(Based);
|
|
@ -0,0 +1,43 @@
|
|||
=== tests/cases/compiler/checkSuperCallBeforeThisAccessing4.ts ===
|
||||
class Based { }
|
||||
>Based : Symbol(Based, Decl(checkSuperCallBeforeThisAccessing4.ts, 0, 0))
|
||||
|
||||
class Derived extends Based {
|
||||
>Derived : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing4.ts, 0, 15))
|
||||
>Based : Symbol(Based, Decl(checkSuperCallBeforeThisAccessing4.ts, 0, 0))
|
||||
|
||||
public x: number;
|
||||
>x : Symbol(x, Decl(checkSuperCallBeforeThisAccessing4.ts, 1, 29))
|
||||
|
||||
constructor() {
|
||||
(() => {
|
||||
this; // No error
|
||||
>this : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing4.ts, 0, 15))
|
||||
|
||||
});
|
||||
() => {
|
||||
this; // No error
|
||||
>this : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing4.ts, 0, 15))
|
||||
|
||||
};
|
||||
(() => {
|
||||
this; // No error
|
||||
>this : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing4.ts, 0, 15))
|
||||
|
||||
})();
|
||||
super();
|
||||
>super : Symbol(Based, Decl(checkSuperCallBeforeThisAccessing4.ts, 0, 0))
|
||||
|
||||
super();
|
||||
>super : Symbol(Based, Decl(checkSuperCallBeforeThisAccessing4.ts, 0, 0))
|
||||
|
||||
this.x = 10;
|
||||
>this.x : Symbol(x, Decl(checkSuperCallBeforeThisAccessing4.ts, 1, 29))
|
||||
>this : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing4.ts, 0, 15))
|
||||
>x : Symbol(x, Decl(checkSuperCallBeforeThisAccessing4.ts, 1, 29))
|
||||
|
||||
var that = this;
|
||||
>that : Symbol(that, Decl(checkSuperCallBeforeThisAccessing4.ts, 16, 11))
|
||||
>this : Symbol(Derived, Decl(checkSuperCallBeforeThisAccessing4.ts, 0, 15))
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
=== tests/cases/compiler/checkSuperCallBeforeThisAccessing4.ts ===
|
||||
class Based { }
|
||||
>Based : Based
|
||||
|
||||
class Derived extends Based {
|
||||
>Derived : Derived
|
||||
>Based : Based
|
||||
|
||||
public x: number;
|
||||
>x : number
|
||||
|
||||
constructor() {
|
||||
(() => {
|
||||
>(() => { this; // No error }) : () => void
|
||||
>() => { this; // No error } : () => void
|
||||
|
||||
this; // No error
|
||||
>this : Derived
|
||||
|
||||
});
|
||||
() => {
|
||||
>() => { this; // No error } : () => void
|
||||
|
||||
this; // No error
|
||||
>this : Derived
|
||||
|
||||
};
|
||||
(() => {
|
||||
>(() => { this; // No error })() : void
|
||||
>(() => { this; // No error }) : () => void
|
||||
>() => { this; // No error } : () => void
|
||||
|
||||
this; // No error
|
||||
>this : Derived
|
||||
|
||||
})();
|
||||
super();
|
||||
>super() : void
|
||||
>super : typeof Based
|
||||
|
||||
super();
|
||||
>super() : void
|
||||
>super : typeof Based
|
||||
|
||||
this.x = 10;
|
||||
>this.x = 10 : number
|
||||
>this.x : number
|
||||
>this : Derived
|
||||
>x : number
|
||||
>10 : number
|
||||
|
||||
var that = this;
|
||||
>that : Derived
|
||||
>this : Derived
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
tests/cases/compiler/checkSuperCallBeforeThisAccessing5.ts(5,9): error TS17006: 'super' has to be called before 'this' accessing.
|
||||
|
||||
|
||||
==== tests/cases/compiler/checkSuperCallBeforeThisAccessing5.ts (1 errors) ====
|
||||
class Based { constructor(...arg) { } }
|
||||
class Derived extends Based {
|
||||
public x: number;
|
||||
constructor() {
|
||||
super(this.x);
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS17006: 'super' has to be called before 'this' accessing.
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
//// [checkSuperCallBeforeThisAccessing5.ts]
|
||||
class Based { constructor(...arg) { } }
|
||||
class Derived extends Based {
|
||||
public x: number;
|
||||
constructor() {
|
||||
super(this.x);
|
||||
}
|
||||
}
|
||||
|
||||
//// [checkSuperCallBeforeThisAccessing5.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Based = (function () {
|
||||
function Based() {
|
||||
var arg = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
arg[_i - 0] = arguments[_i];
|
||||
}
|
||||
}
|
||||
return Based;
|
||||
})();
|
||||
var Derived = (function (_super) {
|
||||
__extends(Derived, _super);
|
||||
function Derived() {
|
||||
_super.call(this, this.x);
|
||||
}
|
||||
return Derived;
|
||||
})(Based);
|
|
@ -0,0 +1,36 @@
|
|||
//// [checkSuperCallBeforeThisAccessing6.ts]
|
||||
class Base {
|
||||
constructor(...arg) {
|
||||
}
|
||||
}
|
||||
class Super extends Base {
|
||||
constructor() {
|
||||
(() => this); // No Error
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
//// [checkSuperCallBeforeThisAccessing6.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Base = (function () {
|
||||
function Base() {
|
||||
var arg = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
arg[_i - 0] = arguments[_i];
|
||||
}
|
||||
}
|
||||
return Base;
|
||||
})();
|
||||
var Super = (function (_super) {
|
||||
__extends(Super, _super);
|
||||
function Super() {
|
||||
var _this = this;
|
||||
(function () { return _this; }); // No Error
|
||||
_super.call(this);
|
||||
}
|
||||
return Super;
|
||||
})(Base);
|
|
@ -0,0 +1,20 @@
|
|||
=== tests/cases/compiler/checkSuperCallBeforeThisAccessing6.ts ===
|
||||
class Base {
|
||||
>Base : Symbol(Base, Decl(checkSuperCallBeforeThisAccessing6.ts, 0, 0))
|
||||
|
||||
constructor(...arg) {
|
||||
>arg : Symbol(arg, Decl(checkSuperCallBeforeThisAccessing6.ts, 1, 16))
|
||||
}
|
||||
}
|
||||
class Super extends Base {
|
||||
>Super : Symbol(Super, Decl(checkSuperCallBeforeThisAccessing6.ts, 3, 1))
|
||||
>Base : Symbol(Base, Decl(checkSuperCallBeforeThisAccessing6.ts, 0, 0))
|
||||
|
||||
constructor() {
|
||||
(() => this); // No Error
|
||||
>this : Symbol(Super, Decl(checkSuperCallBeforeThisAccessing6.ts, 3, 1))
|
||||
|
||||
super();
|
||||
>super : Symbol(Base, Decl(checkSuperCallBeforeThisAccessing6.ts, 0, 0))
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
=== tests/cases/compiler/checkSuperCallBeforeThisAccessing6.ts ===
|
||||
class Base {
|
||||
>Base : Base
|
||||
|
||||
constructor(...arg) {
|
||||
>arg : any[]
|
||||
}
|
||||
}
|
||||
class Super extends Base {
|
||||
>Super : Super
|
||||
>Base : Base
|
||||
|
||||
constructor() {
|
||||
(() => this); // No Error
|
||||
>(() => this) : () => Super
|
||||
>() => this : () => Super
|
||||
>this : Super
|
||||
|
||||
super();
|
||||
>super() : void
|
||||
>super : typeof Base
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
//// [checkSuperCallBeforeThisAccessing7.ts]
|
||||
class Base {
|
||||
constructor(func: ()=>Base) {
|
||||
}
|
||||
}
|
||||
class Super extends Base {
|
||||
constructor() {
|
||||
super((() => this)); // No error
|
||||
}
|
||||
}
|
||||
|
||||
//// [checkSuperCallBeforeThisAccessing7.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Base = (function () {
|
||||
function Base(func) {
|
||||
}
|
||||
return Base;
|
||||
})();
|
||||
var Super = (function (_super) {
|
||||
__extends(Super, _super);
|
||||
function Super() {
|
||||
var _this = this;
|
||||
_super.call(this, (function () { return _this; })); // No error
|
||||
}
|
||||
return Super;
|
||||
})(Base);
|
|
@ -0,0 +1,19 @@
|
|||
=== tests/cases/compiler/checkSuperCallBeforeThisAccessing7.ts ===
|
||||
class Base {
|
||||
>Base : Symbol(Base, Decl(checkSuperCallBeforeThisAccessing7.ts, 0, 0))
|
||||
|
||||
constructor(func: ()=>Base) {
|
||||
>func : Symbol(func, Decl(checkSuperCallBeforeThisAccessing7.ts, 1, 16))
|
||||
>Base : Symbol(Base, Decl(checkSuperCallBeforeThisAccessing7.ts, 0, 0))
|
||||
}
|
||||
}
|
||||
class Super extends Base {
|
||||
>Super : Symbol(Super, Decl(checkSuperCallBeforeThisAccessing7.ts, 3, 1))
|
||||
>Base : Symbol(Base, Decl(checkSuperCallBeforeThisAccessing7.ts, 0, 0))
|
||||
|
||||
constructor() {
|
||||
super((() => this)); // No error
|
||||
>super : Symbol(Base, Decl(checkSuperCallBeforeThisAccessing7.ts, 0, 0))
|
||||
>this : Symbol(Super, Decl(checkSuperCallBeforeThisAccessing7.ts, 3, 1))
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
=== tests/cases/compiler/checkSuperCallBeforeThisAccessing7.ts ===
|
||||
class Base {
|
||||
>Base : Base
|
||||
|
||||
constructor(func: ()=>Base) {
|
||||
>func : () => Base
|
||||
>Base : Base
|
||||
}
|
||||
}
|
||||
class Super extends Base {
|
||||
>Super : Super
|
||||
>Base : Base
|
||||
|
||||
constructor() {
|
||||
super((() => this)); // No error
|
||||
>super((() => this)) : void
|
||||
>super : typeof Base
|
||||
>(() => this) : () => Super
|
||||
>() => this : () => Super
|
||||
>this : Super
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
tests/cases/compiler/checkSuperCallBeforeThisAccessing8.ts(8,9): error TS17006: 'super' has to be called before 'this' accessing.
|
||||
|
||||
|
||||
==== tests/cases/compiler/checkSuperCallBeforeThisAccessing8.ts (1 errors) ====
|
||||
class Base {
|
||||
constructor(...arg) {
|
||||
}
|
||||
}
|
||||
class Super extends Base {
|
||||
constructor() {
|
||||
var that = this;
|
||||
super();
|
||||
~~~~~~~~
|
||||
!!! error TS17006: 'super' has to be called before 'this' accessing.
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
//// [checkSuperCallBeforeThisAccessing8.ts]
|
||||
class Base {
|
||||
constructor(...arg) {
|
||||
}
|
||||
}
|
||||
class Super extends Base {
|
||||
constructor() {
|
||||
var that = this;
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
//// [checkSuperCallBeforeThisAccessing8.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var Base = (function () {
|
||||
function Base() {
|
||||
var arg = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
arg[_i - 0] = arguments[_i];
|
||||
}
|
||||
}
|
||||
return Base;
|
||||
})();
|
||||
var Super = (function (_super) {
|
||||
__extends(Super, _super);
|
||||
function Super() {
|
||||
var that = this;
|
||||
_super.call(this);
|
||||
}
|
||||
return Super;
|
||||
})(Base);
|
|
@ -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(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(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(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(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(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,14 +80,11 @@ 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.
|
||||
}
|
||||
}
|
||||
|
||||
class L extends G {
|
||||
|
@ -104,14 +101,11 @@ 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.
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
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(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(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(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' has to be called before 'this' accessing.
|
||||
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.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts (4 errors) ====
|
||||
==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassParameterProperties.ts (5 errors) ====
|
||||
// ordering of super calls in derived constructors matters depending on other class contents
|
||||
|
||||
class Base {
|
||||
|
@ -20,14 +21,11 @@ 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.
|
||||
}
|
||||
}
|
||||
|
||||
class Derived3 extends Base {
|
||||
|
@ -40,14 +38,11 @@ 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.
|
||||
}
|
||||
}
|
||||
|
||||
class Derived5 extends Base {
|
||||
|
@ -63,7 +58,9 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassP
|
|||
constructor(y: string) {
|
||||
this.a = 1;
|
||||
var b = 2;
|
||||
super(); // ok
|
||||
super(); // error: "super" has to be called before "this" accessing
|
||||
~~~~~~~~
|
||||
!!! error TS17006: 'super' has to be called before 'this' accessing.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,16 +68,12 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassP
|
|||
a = 1;
|
||||
b: number;
|
||||
constructor(y: string) {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
this.a = 3;
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
this.b = 3;
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
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.
|
||||
}
|
||||
}
|
||||
|
||||
class Derived8 extends Base {
|
||||
|
@ -100,16 +93,12 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassP
|
|||
a = 1;
|
||||
b: number;
|
||||
constructor(y: string) {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
this.a = 3;
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
this.b = 3;
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
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.
|
||||
}
|
||||
}
|
||||
|
||||
class Derived10<T> extends Base2<T> {
|
||||
|
|
|
@ -47,7 +47,7 @@ class Derived6 extends Base {
|
|||
constructor(y: string) {
|
||||
this.a = 1;
|
||||
var b = 2;
|
||||
super(); // ok
|
||||
super(); // error: "super" has to be called before "this" accessing
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ var Derived6 = (function (_super) {
|
|||
function Derived6(y) {
|
||||
this.a = 1;
|
||||
var b = 2;
|
||||
_super.call(this); // ok
|
||||
_super.call(this); // error: "super" has to be called before "this" accessing
|
||||
}
|
||||
return Derived6;
|
||||
})(Base);
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts(8,9): error TS17006: 'super' has to be called before 'this' accessing.
|
||||
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.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts (2 errors) ====
|
||||
==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsWithThisArg.ts (3 errors) ====
|
||||
class Base {
|
||||
x: string;
|
||||
constructor(a) { }
|
||||
|
@ -11,6 +12,8 @@ tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassS
|
|||
class Derived extends Base {
|
||||
constructor() {
|
||||
super(this); // ok
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS17006: 'super' has to be called before 'this' accessing.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
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(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 (1 errors) ====
|
||||
|
@ -29,16 +29,12 @@ tests/cases/compiler/strictModeInConstructor.ts(27,5): error TS2376: A 'super' c
|
|||
public s: number = 9;
|
||||
|
||||
constructor () {
|
||||
~~~~~~~~~~~~~~~~
|
||||
var x = 1; // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
super();
|
||||
~~~~~~~~~~~~~~~~
|
||||
"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.
|
||||
"use strict";
|
||||
}
|
||||
}
|
||||
|
||||
class Bs extends A {
|
||||
|
|
|
@ -1,4 +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' has to be called before 'this' accessing.
|
||||
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.
|
||||
|
@ -23,7 +24,9 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContexts.ts(45,9):
|
|||
t;
|
||||
//'this' in optional super call
|
||||
constructor() {
|
||||
super(this); // OK
|
||||
super(this); // Error
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS17006: 'super' has to be called before 'this' accessing.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class ClassWithNoInitializer extends BaseErrClass {
|
|||
t;
|
||||
//'this' in optional super call
|
||||
constructor() {
|
||||
super(this); // OK
|
||||
super(this); // Error
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ var ClassWithNoInitializer = (function (_super) {
|
|||
__extends(ClassWithNoInitializer, _super);
|
||||
//'this' in optional super call
|
||||
function ClassWithNoInitializer() {
|
||||
_super.call(this, this); // OK
|
||||
_super.call(this, this); // Error
|
||||
}
|
||||
return ClassWithNoInitializer;
|
||||
})(BaseErrClass);
|
||||
|
|
|
@ -1,4 +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' has to be called before 'this' accessing.
|
||||
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.
|
||||
|
@ -24,7 +25,9 @@ tests/cases/conformance/expressions/thisKeyword/thisInInvalidContextsExternalMod
|
|||
t;
|
||||
//'this' in optional super call
|
||||
constructor() {
|
||||
super(this); // OK
|
||||
super(this); // error: "super" has to be called before "this" accessing
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS17006: 'super' has to be called before 'this' accessing.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class ClassWithNoInitializer extends BaseErrClass {
|
|||
t;
|
||||
//'this' in optional super call
|
||||
constructor() {
|
||||
super(this); // OK
|
||||
super(this); // error: "super" has to be called before "this" accessing
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ var ClassWithNoInitializer = (function (_super) {
|
|||
__extends(ClassWithNoInitializer, _super);
|
||||
//'this' in optional super call
|
||||
function ClassWithNoInitializer() {
|
||||
_super.call(this, this); // OK
|
||||
_super.call(this, this); // error: "super" has to be called before "this" accessing
|
||||
}
|
||||
return ClassWithNoInitializer;
|
||||
})(BaseErrClass);
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
tests/cases/compiler/thisInSuperCall.ts(7,9): error TS17006: 'super' has to be called before 'this' accessing.
|
||||
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.
|
||||
|
||||
|
||||
==== tests/cases/compiler/thisInSuperCall.ts (2 errors) ====
|
||||
==== tests/cases/compiler/thisInSuperCall.ts (3 errors) ====
|
||||
class Base {
|
||||
constructor(x: any) {}
|
||||
}
|
||||
|
||||
class Foo extends Base {
|
||||
constructor() {
|
||||
super(this); // no error
|
||||
super(this); // error: "super" has to be called before "this" accessing
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS17006: 'super' has to be called before 'this' accessing.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ class Base {
|
|||
|
||||
class Foo extends Base {
|
||||
constructor() {
|
||||
super(this); // no error
|
||||
super(this); // error: "super" has to be called before "this" accessing
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ var Base = (function () {
|
|||
var Foo = (function (_super) {
|
||||
__extends(Foo, _super);
|
||||
function Foo() {
|
||||
_super.call(this, this); // no error
|
||||
_super.call(this, this); // error: "super" has to be called before "this" accessing
|
||||
}
|
||||
return Foo;
|
||||
})(Base);
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
tests/cases/compiler/thisInSuperCall2.ts(8,9): error TS17006: 'super' has to be called before 'this' accessing.
|
||||
tests/cases/compiler/thisInSuperCall2.ts(16,15): error TS2332: 'this' cannot be referenced in current location.
|
||||
|
||||
|
||||
==== tests/cases/compiler/thisInSuperCall2.ts (1 errors) ====
|
||||
==== tests/cases/compiler/thisInSuperCall2.ts (2 errors) ====
|
||||
class Base {
|
||||
constructor(a: any) {}
|
||||
}
|
||||
|
@ -9,7 +10,9 @@ tests/cases/compiler/thisInSuperCall2.ts(16,15): error TS2332: 'this' cannot be
|
|||
class Foo extends Base {
|
||||
public x: number;
|
||||
constructor() {
|
||||
super(this); // no error
|
||||
super(this); // error: "super" has to be called before "this" accessing
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS17006: 'super' has to be called before 'this' accessing.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ class Base {
|
|||
class Foo extends Base {
|
||||
public x: number;
|
||||
constructor() {
|
||||
super(this); // no error
|
||||
super(this); // error: "super" has to be called before "this" accessing
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ var Base = (function () {
|
|||
var Foo = (function (_super) {
|
||||
__extends(Foo, _super);
|
||||
function Foo() {
|
||||
_super.call(this, this); // no error
|
||||
_super.call(this, this); // error: "super" has to be called before "this" accessing
|
||||
}
|
||||
return Foo;
|
||||
})(Base);
|
||||
|
|
|
@ -4,7 +4,7 @@ class Base {
|
|||
|
||||
class Foo extends Base {
|
||||
constructor() {
|
||||
super(this); // no error
|
||||
super(this); // error: "super" has to be called before "this" accessing
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ class Base {
|
|||
class Foo extends Base {
|
||||
public x: number;
|
||||
constructor() {
|
||||
super(this); // no error
|
||||
super(this); // error: "super" has to be called before "this" accessing
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class Derived6 extends Base {
|
|||
constructor(y: string) {
|
||||
this.a = 1;
|
||||
var b = 2;
|
||||
super(); // ok
|
||||
super(); // error: "super" has to be called before "this" accessing
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class ClassWithNoInitializer extends BaseErrClass {
|
|||
t;
|
||||
//'this' in optional super call
|
||||
constructor() {
|
||||
super(this); // OK
|
||||
super(this); // Error
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class ClassWithNoInitializer extends BaseErrClass {
|
|||
t;
|
||||
//'this' in optional super call
|
||||
constructor() {
|
||||
super(this); // OK
|
||||
super(this); // error: "super" has to be called before "this" accessing
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue