* Always generate type & symbol baselines * Accept changed shadowed baselines * Accept brand new type and symbol baselines * Allow `getTypeAtLocation` to return undefined in the type writer * Accept baselines which had missing type information * Bind container for dynamically names enum members so they may be printed * Accept type/symbol baselines for enums with computed members * First pass at reducing typeWriter memory overhead * Use generators to allow for type and symbol baselines with no cache * Accept new baselines for tests whose output was fixed by better newline splitting * Hard cap on number of declarations printed, cache declaration print text * handle differing newlines better still to handle RWC newlines * Lower abridging count, accept abridged baselines * Limit max RWC error output size, limit RWC type and symbol baseline input size * Move skip logic into type and symbol baseliner to streamline error handling * Accept removal of empty baselines * Canonicalize path earlier to handle odd paths in input files * Do canonicalization earlier still, also ensure parallel perf profiles for different targets do not trample one another * No need to pathify again
503 lines
11 KiB
Text
503 lines
11 KiB
Text
=== tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts ===
|
|
class MyTestClass {
|
|
>MyTestClass : MyTestClass
|
|
|
|
private canary: number;
|
|
>canary : number
|
|
|
|
static staticCanary: number;
|
|
>staticCanary : number
|
|
|
|
constructor() {
|
|
//type of 'this' in constructor body is the class instance type
|
|
var p = this.canary;
|
|
>p : number
|
|
>this.canary : number
|
|
>this : this
|
|
>canary : number
|
|
|
|
var p: number;
|
|
>p : number
|
|
|
|
this.canary = 3;
|
|
>this.canary = 3 : 3
|
|
>this.canary : number
|
|
>this : this
|
|
>canary : number
|
|
>3 : 3
|
|
}
|
|
|
|
//type of 'this' in member function param list is the class instance type
|
|
memberFunc(t = this) {
|
|
>memberFunc : (t?: this) => void
|
|
>t : this
|
|
>this : this
|
|
|
|
var t: MyTestClass;
|
|
>t : this
|
|
>MyTestClass : MyTestClass
|
|
|
|
//type of 'this' in member function body is the class instance type
|
|
var p = this;
|
|
>p : this
|
|
>this : this
|
|
|
|
var p: MyTestClass;
|
|
>p : this
|
|
>MyTestClass : MyTestClass
|
|
}
|
|
|
|
//type of 'this' in member accessor(get and set) body is the class instance type
|
|
get prop() {
|
|
>prop : this
|
|
|
|
var p = this;
|
|
>p : this
|
|
>this : this
|
|
|
|
var p: MyTestClass;
|
|
>p : this
|
|
>MyTestClass : MyTestClass
|
|
|
|
return this;
|
|
>this : this
|
|
}
|
|
set prop(v) {
|
|
>prop : this
|
|
>v : this
|
|
|
|
var p = this;
|
|
>p : this
|
|
>this : this
|
|
|
|
var p: MyTestClass;
|
|
>p : this
|
|
>MyTestClass : MyTestClass
|
|
|
|
p = v;
|
|
>p = v : this
|
|
>p : this
|
|
>v : this
|
|
|
|
v = p;
|
|
>v = p : this
|
|
>v : this
|
|
>p : this
|
|
}
|
|
|
|
someFunc = () => {
|
|
>someFunc : () => void
|
|
>() => { //type of 'this' in member variable initializer is the class instance type var t = this; var t: MyTestClass; } : () => void
|
|
|
|
//type of 'this' in member variable initializer is the class instance type
|
|
var t = this;
|
|
>t : this
|
|
>this : this
|
|
|
|
var t: MyTestClass;
|
|
>t : this
|
|
>MyTestClass : MyTestClass
|
|
|
|
};
|
|
|
|
//type of 'this' in static function param list is constructor function type
|
|
static staticFn(t = this) {
|
|
>staticFn : (t?: typeof MyTestClass) => void
|
|
>t : typeof MyTestClass
|
|
>this : typeof MyTestClass
|
|
|
|
var t: typeof MyTestClass;
|
|
>t : typeof MyTestClass
|
|
>MyTestClass : typeof MyTestClass
|
|
|
|
var t = MyTestClass;
|
|
>t : typeof MyTestClass
|
|
>MyTestClass : typeof MyTestClass
|
|
|
|
t.staticCanary;
|
|
>t.staticCanary : number
|
|
>t : typeof MyTestClass
|
|
>staticCanary : number
|
|
|
|
//type of 'this' in static function body is constructor function type
|
|
var p = this;
|
|
>p : typeof MyTestClass
|
|
>this : typeof MyTestClass
|
|
|
|
var p: typeof MyTestClass;
|
|
>p : typeof MyTestClass
|
|
>MyTestClass : typeof MyTestClass
|
|
|
|
var p = MyTestClass;
|
|
>p : typeof MyTestClass
|
|
>MyTestClass : typeof MyTestClass
|
|
|
|
p.staticCanary;
|
|
>p.staticCanary : number
|
|
>p : typeof MyTestClass
|
|
>staticCanary : number
|
|
}
|
|
|
|
static get staticProp() {
|
|
>staticProp : typeof MyTestClass
|
|
|
|
//type of 'this' in static accessor body is constructor function type
|
|
var p = this;
|
|
>p : typeof MyTestClass
|
|
>this : typeof MyTestClass
|
|
|
|
var p: typeof MyTestClass;
|
|
>p : typeof MyTestClass
|
|
>MyTestClass : typeof MyTestClass
|
|
|
|
var p = MyTestClass;
|
|
>p : typeof MyTestClass
|
|
>MyTestClass : typeof MyTestClass
|
|
|
|
p.staticCanary;
|
|
>p.staticCanary : number
|
|
>p : typeof MyTestClass
|
|
>staticCanary : number
|
|
|
|
return this;
|
|
>this : typeof MyTestClass
|
|
}
|
|
static set staticProp(v: typeof MyTestClass) {
|
|
>staticProp : typeof MyTestClass
|
|
>v : typeof MyTestClass
|
|
>MyTestClass : typeof MyTestClass
|
|
|
|
//type of 'this' in static accessor body is constructor function type
|
|
var p = this;
|
|
>p : typeof MyTestClass
|
|
>this : typeof MyTestClass
|
|
|
|
var p: typeof MyTestClass;
|
|
>p : typeof MyTestClass
|
|
>MyTestClass : typeof MyTestClass
|
|
|
|
var p = MyTestClass;
|
|
>p : typeof MyTestClass
|
|
>MyTestClass : typeof MyTestClass
|
|
|
|
p.staticCanary;
|
|
>p.staticCanary : number
|
|
>p : typeof MyTestClass
|
|
>staticCanary : number
|
|
}
|
|
}
|
|
|
|
class MyGenericTestClass<T, U> {
|
|
>MyGenericTestClass : MyGenericTestClass<T, U>
|
|
>T : T
|
|
>U : U
|
|
|
|
private canary: number;
|
|
>canary : number
|
|
|
|
static staticCanary: number;
|
|
>staticCanary : number
|
|
|
|
constructor() {
|
|
//type of 'this' in constructor body is the class instance type
|
|
var p = this.canary;
|
|
>p : number
|
|
>this.canary : number
|
|
>this : this
|
|
>canary : number
|
|
|
|
var p: number;
|
|
>p : number
|
|
|
|
this.canary = 3;
|
|
>this.canary = 3 : 3
|
|
>this.canary : number
|
|
>this : this
|
|
>canary : number
|
|
>3 : 3
|
|
}
|
|
|
|
//type of 'this' in member function param list is the class instance type
|
|
memberFunc(t = this) {
|
|
>memberFunc : (t?: this) => void
|
|
>t : this
|
|
>this : this
|
|
|
|
var t: MyGenericTestClass<T, U>;
|
|
>t : this
|
|
>MyGenericTestClass : MyGenericTestClass<T, U>
|
|
>T : T
|
|
>U : U
|
|
|
|
//type of 'this' in member function body is the class instance type
|
|
var p = this;
|
|
>p : this
|
|
>this : this
|
|
|
|
var p: MyGenericTestClass<T, U>;
|
|
>p : this
|
|
>MyGenericTestClass : MyGenericTestClass<T, U>
|
|
>T : T
|
|
>U : U
|
|
}
|
|
|
|
//type of 'this' in member accessor(get and set) body is the class instance type
|
|
get prop() {
|
|
>prop : this
|
|
|
|
var p = this;
|
|
>p : this
|
|
>this : this
|
|
|
|
var p: MyGenericTestClass<T, U>;
|
|
>p : this
|
|
>MyGenericTestClass : MyGenericTestClass<T, U>
|
|
>T : T
|
|
>U : U
|
|
|
|
return this;
|
|
>this : this
|
|
}
|
|
set prop(v) {
|
|
>prop : this
|
|
>v : this
|
|
|
|
var p = this;
|
|
>p : this
|
|
>this : this
|
|
|
|
var p: MyGenericTestClass<T, U>;
|
|
>p : this
|
|
>MyGenericTestClass : MyGenericTestClass<T, U>
|
|
>T : T
|
|
>U : U
|
|
|
|
p = v;
|
|
>p = v : this
|
|
>p : this
|
|
>v : this
|
|
|
|
v = p;
|
|
>v = p : this
|
|
>v : this
|
|
>p : this
|
|
}
|
|
|
|
someFunc = () => {
|
|
>someFunc : () => void
|
|
>() => { //type of 'this' in member variable initializer is the class instance type var t = this; var t: MyGenericTestClass<T, U>; } : () => void
|
|
|
|
//type of 'this' in member variable initializer is the class instance type
|
|
var t = this;
|
|
>t : this
|
|
>this : this
|
|
|
|
var t: MyGenericTestClass<T, U>;
|
|
>t : this
|
|
>MyGenericTestClass : MyGenericTestClass<T, U>
|
|
>T : T
|
|
>U : U
|
|
|
|
};
|
|
|
|
//type of 'this' in static function param list is constructor function type
|
|
static staticFn(t = this) {
|
|
>staticFn : (t?: typeof MyGenericTestClass) => void
|
|
>t : typeof MyGenericTestClass
|
|
>this : typeof MyGenericTestClass
|
|
|
|
var t: typeof MyGenericTestClass;
|
|
>t : typeof MyGenericTestClass
|
|
>MyGenericTestClass : typeof MyGenericTestClass
|
|
|
|
var t = MyGenericTestClass;
|
|
>t : typeof MyGenericTestClass
|
|
>MyGenericTestClass : typeof MyGenericTestClass
|
|
|
|
t.staticCanary;
|
|
>t.staticCanary : number
|
|
>t : typeof MyGenericTestClass
|
|
>staticCanary : number
|
|
|
|
//type of 'this' in static function body is constructor function type
|
|
var p = this;
|
|
>p : typeof MyGenericTestClass
|
|
>this : typeof MyGenericTestClass
|
|
|
|
var p: typeof MyGenericTestClass;
|
|
>p : typeof MyGenericTestClass
|
|
>MyGenericTestClass : typeof MyGenericTestClass
|
|
|
|
var p = MyGenericTestClass;
|
|
>p : typeof MyGenericTestClass
|
|
>MyGenericTestClass : typeof MyGenericTestClass
|
|
|
|
p.staticCanary;
|
|
>p.staticCanary : number
|
|
>p : typeof MyGenericTestClass
|
|
>staticCanary : number
|
|
}
|
|
|
|
static get staticProp() {
|
|
>staticProp : typeof MyGenericTestClass
|
|
|
|
//type of 'this' in static accessor body is constructor function type
|
|
var p = this;
|
|
>p : typeof MyGenericTestClass
|
|
>this : typeof MyGenericTestClass
|
|
|
|
var p: typeof MyGenericTestClass;
|
|
>p : typeof MyGenericTestClass
|
|
>MyGenericTestClass : typeof MyGenericTestClass
|
|
|
|
var p = MyGenericTestClass;
|
|
>p : typeof MyGenericTestClass
|
|
>MyGenericTestClass : typeof MyGenericTestClass
|
|
|
|
p.staticCanary;
|
|
>p.staticCanary : number
|
|
>p : typeof MyGenericTestClass
|
|
>staticCanary : number
|
|
|
|
return this;
|
|
>this : typeof MyGenericTestClass
|
|
}
|
|
static set staticProp(v: typeof MyGenericTestClass) {
|
|
>staticProp : typeof MyGenericTestClass
|
|
>v : typeof MyGenericTestClass
|
|
>MyGenericTestClass : typeof MyGenericTestClass
|
|
|
|
//type of 'this' in static accessor body is constructor function type
|
|
var p = this;
|
|
>p : typeof MyGenericTestClass
|
|
>this : typeof MyGenericTestClass
|
|
|
|
var p: typeof MyGenericTestClass;
|
|
>p : typeof MyGenericTestClass
|
|
>MyGenericTestClass : typeof MyGenericTestClass
|
|
|
|
var p = MyGenericTestClass;
|
|
>p : typeof MyGenericTestClass
|
|
>MyGenericTestClass : typeof MyGenericTestClass
|
|
|
|
p.staticCanary;
|
|
>p.staticCanary : number
|
|
>p : typeof MyGenericTestClass
|
|
>staticCanary : number
|
|
}
|
|
}
|
|
|
|
//type of 'this' in a function declaration param list is Any
|
|
function fn(s = this) {
|
|
>fn : (s?: any) => void
|
|
>s : any
|
|
>this : any
|
|
|
|
var s: any;
|
|
>s : any
|
|
|
|
s.spaaaaaaace = 4;
|
|
>s.spaaaaaaace = 4 : 4
|
|
>s.spaaaaaaace : any
|
|
>s : any
|
|
>spaaaaaaace : any
|
|
>4 : 4
|
|
|
|
//type of 'this' in a function declaration body is Any
|
|
var t: any;
|
|
>t : any
|
|
|
|
var t = this;
|
|
>t : any
|
|
>this : any
|
|
|
|
this.spaaaaace = 4;
|
|
>this.spaaaaace = 4 : 4
|
|
>this.spaaaaace : any
|
|
>this : any
|
|
>spaaaaace : any
|
|
>4 : 4
|
|
}
|
|
|
|
//type of 'this' in a function expression param list list is Any
|
|
var q1 = function (s = this) {
|
|
>q1 : (s?: any) => void
|
|
>function (s = this) { var s: any; s.spaaaaaaace = 4; //type of 'this' in a function expression body is Any var t: any; var t = this; this.spaaaaace = 4;} : (s?: any) => void
|
|
>s : any
|
|
>this : any
|
|
|
|
var s: any;
|
|
>s : any
|
|
|
|
s.spaaaaaaace = 4;
|
|
>s.spaaaaaaace = 4 : 4
|
|
>s.spaaaaaaace : any
|
|
>s : any
|
|
>spaaaaaaace : any
|
|
>4 : 4
|
|
|
|
//type of 'this' in a function expression body is Any
|
|
var t: any;
|
|
>t : any
|
|
|
|
var t = this;
|
|
>t : any
|
|
>this : any
|
|
|
|
this.spaaaaace = 4;
|
|
>this.spaaaaace = 4 : 4
|
|
>this.spaaaaace : any
|
|
>this : any
|
|
>spaaaaace : any
|
|
>4 : 4
|
|
}
|
|
|
|
//type of 'this' in a fat arrow expression param list is Any
|
|
var q2 = (s = this) => {
|
|
>q2 : (s?: any) => void
|
|
>(s = this) => { var s: any; s.spaaaaaaace = 4; //type of 'this' in a fat arrow expression body is Any var t: any; var t = this; this.spaaaaace = 4;} : (s?: any) => void
|
|
>s : any
|
|
>this : any
|
|
|
|
var s: any;
|
|
>s : any
|
|
|
|
s.spaaaaaaace = 4;
|
|
>s.spaaaaaaace = 4 : 4
|
|
>s.spaaaaaaace : any
|
|
>s : any
|
|
>spaaaaaaace : any
|
|
>4 : 4
|
|
|
|
//type of 'this' in a fat arrow expression body is Any
|
|
var t: any;
|
|
>t : any
|
|
|
|
var t = this;
|
|
>t : any
|
|
>this : any
|
|
|
|
this.spaaaaace = 4;
|
|
>this.spaaaaace = 4 : 4
|
|
>this.spaaaaace : any
|
|
>this : any
|
|
>spaaaaace : any
|
|
>4 : 4
|
|
}
|
|
|
|
//type of 'this' in global module is Any
|
|
var t: any;
|
|
>t : any
|
|
|
|
var t = this;
|
|
>t : any
|
|
>this : any
|
|
|
|
this.spaaaaace = 4;
|
|
>this.spaaaaace = 4 : 4
|
|
>this.spaaaaace : any
|
|
>this : any
|
|
>spaaaaace : any
|
|
>4 : 4
|
|
|
|
|