Update baselines

1. Display of `this` changes for quick info.
2. The type of Function.call/apply/bind is more precise.
This commit is contained in:
Nathan Shively-Sanders 2016-01-29 14:52:47 -08:00
parent a4f1154377
commit d030889166
17 changed files with 108 additions and 47 deletions

View File

@ -5,7 +5,7 @@ tests/cases/compiler/assignmentToObjectAndFunction.ts(8,5): error TS2322: Type '
Property 'apply' is missing in type '{}'.
tests/cases/compiler/assignmentToObjectAndFunction.ts(29,5): error TS2322: Type 'typeof bad' is not assignable to type 'Function'.
Types of property 'apply' are incompatible.
Type 'number' is not assignable to type '(thisArg: any, argArray?: any) => any'.
Type 'number' is not assignable to type '{ <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }'.
==== tests/cases/compiler/assignmentToObjectAndFunction.ts (3 errors) ====
@ -48,4 +48,4 @@ tests/cases/compiler/assignmentToObjectAndFunction.ts(29,5): error TS2322: Type
~~~~~~~~~~
!!! error TS2322: Type 'typeof bad' is not assignable to type 'Function'.
!!! error TS2322: Types of property 'apply' are incompatible.
!!! error TS2322: Type 'number' is not assignable to type '(thisArg: any, argArray?: any) => any'.
!!! error TS2322: Type 'number' is not assignable to type '{ <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }'.

View File

@ -10,9 +10,9 @@ class C {
var fn = async () => await other.apply(this, arguments);
>fn : Symbol(fn, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 3, 9))
>other.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
>other.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>other : Symbol(other, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 1, 13))
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>this : Symbol(C, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 0, 0))
>arguments : Symbol(arguments)
}

View File

@ -9,13 +9,13 @@ class C {
>other : () => void
var fn = async () => await other.apply(this, arguments);
>fn : () => Promise<any>
>async () => await other.apply(this, arguments) : () => Promise<any>
>await other.apply(this, arguments) : any
>other.apply(this, arguments) : any
>other.apply : (thisArg: any, argArray?: any) => any
>fn : () => Promise<void>
>async () => await other.apply(this, arguments) : () => Promise<void>
>await other.apply(this, arguments) : void
>other.apply(this, arguments) : void
>other.apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
>other : () => void
>apply : (thisArg: any, argArray?: any) => any
>apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
>this : this
>arguments : IArguments
}

View File

@ -12,7 +12,7 @@ function fn(x = () => this, y = x()) {
}
fn.call(4); // Should be 4
>fn.call : Symbol(Function.call, Decl(lib.d.ts, --, --))
>fn.call : Symbol(Function.call, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>fn : Symbol(fn, Decl(fatarrowfunctionsInFunctionParameterDefaults.ts, 0, 0))
>call : Symbol(Function.call, Decl(lib.d.ts, --, --))
>call : Symbol(Function.call, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))

View File

@ -16,8 +16,8 @@ function fn(x = () => this, y = x()) {
fn.call(4); // Should be 4
>fn.call(4) : any
>fn.call : (thisArg: any, ...argArray: any[]) => any
>fn.call : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): U; (this: Function, thisArg: any, ...argArray: any[]): any; }
>fn : (x?: () => any, y?: any) => any
>call : (thisArg: any, ...argArray: any[]) => any
>call : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): U; (this: Function, thisArg: any, ...argArray: any[]): any; }
>4 : number

View File

@ -3,9 +3,9 @@ function salt() {}
>salt : Symbol(salt, Decl(functionType.ts, 0, 0))
salt.apply("hello", []);
>salt.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
>salt.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>salt : Symbol(salt, Decl(functionType.ts, 0, 0))
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
(new Function("return 5"))();
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))

View File

@ -3,10 +3,10 @@ function salt() {}
>salt : () => void
salt.apply("hello", []);
>salt.apply("hello", []) : any
>salt.apply : (thisArg: any, argArray?: any) => any
>salt.apply("hello", []) : void
>salt.apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
>salt : () => void
>apply : (thisArg: any, argArray?: any) => any
>apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
>"hello" : string
>[] : undefined[]

View File

@ -24,9 +24,9 @@ function compose<A, B, C>(f: (b: B) => C, g: (a:A) => B): (a:A) => C {
return f(g.apply(null, a));
>f : Symbol(f, Decl(genericTypeParameterEquivalence2.ts, 1, 26))
>g.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
>g.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>g : Symbol(g, Decl(genericTypeParameterEquivalence2.ts, 1, 41))
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>a : Symbol(a, Decl(genericTypeParameterEquivalence2.ts, 2, 21))
};

View File

@ -26,10 +26,10 @@ function compose<A, B, C>(f: (b: B) => C, g: (a:A) => B): (a:A) => C {
return f(g.apply(null, a));
>f(g.apply(null, a)) : C
>f : (b: B) => C
>g.apply(null, a) : any
>g.apply : (thisArg: any, argArray?: any) => any
>g.apply(null, a) : B
>g.apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
>g : (a: A) => B
>apply : (thisArg: any, argArray?: any) => any
>apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
>null : null
>a : A

View File

@ -20,9 +20,9 @@ var r2b: (x: any, y?: any) => any = i.apply;
>r2b : Symbol(r2b, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 9, 3))
>x : Symbol(x, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 9, 10))
>y : Symbol(y, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 9, 17))
>i.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
>i.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>i : Symbol(i, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 7, 3))
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
var b: {
>b : Symbol(b, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 11, 3))
@ -38,7 +38,7 @@ var rb4: (x: any, y?: any) => any = b.apply;
>rb4 : Symbol(rb4, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 16, 3))
>x : Symbol(x, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 16, 10))
>y : Symbol(y, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 16, 17))
>b.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
>b.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>b : Symbol(b, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 11, 3))
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))

View File

@ -21,9 +21,9 @@ var r2b: (x: any, y?: any) => any = i.apply;
>r2b : (x: any, y?: any) => any
>x : any
>y : any
>i.apply : (thisArg: any, argArray?: any) => any
>i.apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
>i : I
>apply : (thisArg: any, argArray?: any) => any
>apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
var b: {
>b : () => void
@ -40,7 +40,7 @@ var rb4: (x: any, y?: any) => any = b.apply;
>rb4 : (x: any, y?: any) => any
>x : any
>y : any
>b.apply : (thisArg: any, argArray?: any) => any
>b.apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
>b : () => void
>apply : (thisArg: any, argArray?: any) => any
>apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }

View File

@ -12,13 +12,13 @@ module M1 {
>A : Symbol(A, Decl(returnTypeParameterWithModules.ts, 1, 27))
return Array.prototype.reduce.apply(ar, e ? [f, e] : [f]);
>Array.prototype.reduce.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
>Array.prototype.reduce.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Array.prototype.reduce : Symbol(Array.reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Array.prototype : Symbol(ArrayConstructor.prototype, Decl(lib.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>prototype : Symbol(ArrayConstructor.prototype, Decl(lib.d.ts, --, --))
>reduce : Symbol(Array.reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --))
>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>ar : Symbol(ar, Decl(returnTypeParameterWithModules.ts, 1, 30))
>e : Symbol(e, Decl(returnTypeParameterWithModules.ts, 1, 36))
>f : Symbol(f, Decl(returnTypeParameterWithModules.ts, 1, 33))

View File

@ -13,13 +13,13 @@ module M1 {
return Array.prototype.reduce.apply(ar, e ? [f, e] : [f]);
>Array.prototype.reduce.apply(ar, e ? [f, e] : [f]) : any
>Array.prototype.reduce.apply : (thisArg: any, argArray?: any) => any
>Array.prototype.reduce.apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
>Array.prototype.reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
>Array.prototype : any[]
>Array : ArrayConstructor
>prototype : any[]
>reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; <U>(callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; }
>apply : (thisArg: any, argArray?: any) => any
>apply : { <T, U>(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }
>ar : any
>e ? [f, e] : [f] : any[]
>e : any

View File

@ -694,7 +694,7 @@ verify.completionListContains("a", "(parameter) a: number", "this is first param
verify.quickInfoIs("(parameter) a: number", "this is first parameter a\nmore info about a");
goTo.marker('116');
verify.quickInfoIs("class cWithConstructorProperty", "");
verify.quickInfoIs("this: this", "");
goTo.marker('117');
verify.quickInfoIs("(local var) bbbb: number", "");

View File

@ -11,4 +11,4 @@ goTo.marker('1');
verify.quickInfoIs('(property) G<T>.self: G<T>');
goTo.marker('2');
verify.quickInfoIs('class G<T>');
verify.quickInfoIs('this: this');

View File

@ -1,15 +1,76 @@
// @strictThis: true
/// <reference path='fourslash.ts' />
////function someFn1(someFn: { (): void; }) { }
////interface Restricted {
//// n: number;
////}
////function wrapper(wrapped: { (): void; }) { }
////class Foo {
//// public bar() {
//// someFn1(
//// function doSomething() {
//// console.log(th/**/is);
//// n: number;
//// public implicitThis() {
//// wrapper(
//// function implicitVoid() {
//// console.log(th/*1*/is);
//// }
//// )
//// console.log(th/*2*/is);
//// }
//// public explicitInterface(th/*3*/is: Restricted) {
//// console.log(th/*4*/is);
//// }
//// public explicitClass(th/*5*/is: Foo) {
//// console.log(th/*6*/is);
//// }
////}
////class Bar<T> {
//// public implicitThis() {
//// console.log(th/*7*/is);
//// }
//// public explicitThis(this: Bar<T>) {
//// console.log(thi/*8*/s);
//// }
////}
////
////function implicitVoid(x: number): void {
//// return th/*9*/is;
////}
////function explicitVoid(th/*10*/is: void, x: number): void {
//// return th/*11*/is;
////}
////function explicitInterface(th/*12*/is: Restricted): void {
//// console.log(thi/*13*/s);
////}
////function explicitLiteral(th/*14*/is: { n: number }): void {
//// console.log(th/*15*/is);
////}
goTo.marker();
verify.quickInfoIs('any');
goTo.marker('1');
verify.quickInfoIs('void');
goTo.marker('2');
verify.quickInfoIs('this: this');
goTo.marker('3');
verify.quickInfoIs('(parameter) this: Restricted');
goTo.marker('4');
verify.quickInfoIs('this: Restricted');
goTo.marker('5');
verify.quickInfoIs('(parameter) this: Foo');
goTo.marker('6');
verify.quickInfoIs('this: Foo');
goTo.marker('7');
verify.quickInfoIs('this: this');
goTo.marker('8');
verify.quickInfoIs('this: Bar<T>');
goTo.marker('9');
verify.quickInfoIs('void');
goTo.marker('10');
verify.quickInfoIs('(parameter) this: void');
goTo.marker('11');
verify.quickInfoIs('void');
goTo.marker('12');
verify.quickInfoIs('(parameter) this: Restricted');
goTo.marker('13');
verify.quickInfoIs('this: Restricted');
goTo.marker('14');
verify.quickInfoIs('(parameter) this: {\n n: number;\n}');
goTo.marker('15');
verify.quickInfoIs('this: {\n n: number;\n}');

View File

@ -9,4 +9,4 @@
////}
goTo.marker();
verify.quickInfoIs('class Greeter');
verify.quickInfoIs('this: this');