2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/compiler/callbacksDontShareTypes.ts ===
|
|
|
|
interface Collection<T> {
|
|
|
|
>Collection : Collection<T>
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
length: number;
|
|
|
|
>length : number
|
|
|
|
|
|
|
|
add(x: T): void;
|
|
|
|
>add : (x: T) => void
|
|
|
|
>x : T
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
remove(x: T): boolean;
|
|
|
|
>remove : (x: T) => boolean
|
|
|
|
>x : T
|
|
|
|
>T : T
|
|
|
|
}
|
|
|
|
interface Combinators {
|
|
|
|
>Combinators : Combinators
|
|
|
|
|
|
|
|
map<T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>;
|
|
|
|
>map : { <T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>; <T>(c: Collection<T>, f: (x: T) => any): Collection<any>; }
|
|
|
|
>T : T
|
|
|
|
>U : U
|
|
|
|
>c : Collection<T>
|
2014-08-19 04:56:03 +02:00
|
|
|
>Collection : Collection<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
>f : (x: T) => U
|
|
|
|
>x : T
|
|
|
|
>T : T
|
|
|
|
>U : U
|
2014-08-19 04:56:03 +02:00
|
|
|
>Collection : Collection<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>U : U
|
|
|
|
|
|
|
|
map<T>(c: Collection<T>, f: (x: T) => any): Collection<any>;
|
|
|
|
>map : { <T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>; <T>(c: Collection<T>, f: (x: T) => any): Collection<any>; }
|
|
|
|
>T : T
|
|
|
|
>c : Collection<T>
|
2014-08-19 04:56:03 +02:00
|
|
|
>Collection : Collection<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
>f : (x: T) => any
|
|
|
|
>x : T
|
|
|
|
>T : T
|
2014-08-19 04:56:03 +02:00
|
|
|
>Collection : Collection<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
var _: Combinators;
|
|
|
|
>_ : Combinators
|
|
|
|
>Combinators : Combinators
|
|
|
|
|
|
|
|
var c2: Collection<number>;
|
|
|
|
>c2 : Collection<number>
|
2014-08-19 04:56:03 +02:00
|
|
|
>Collection : Collection<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var rf1 = (x: number) => { return x.toFixed() };
|
|
|
|
>rf1 : (x: number) => string
|
|
|
|
>(x: number) => { return x.toFixed() } : (x: number) => string
|
|
|
|
>x : number
|
|
|
|
>x.toFixed() : string
|
|
|
|
>x.toFixed : (fractionDigits?: number) => string
|
|
|
|
>x : number
|
|
|
|
>toFixed : (fractionDigits?: number) => string
|
|
|
|
|
|
|
|
var r1a = _.map(c2, (x) => { return x.toFixed() });
|
|
|
|
>r1a : Collection<string>
|
|
|
|
>_.map(c2, (x) => { return x.toFixed() }) : Collection<string>
|
|
|
|
>_.map : { <T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>; <T>(c: Collection<T>, f: (x: T) => any): Collection<any>; }
|
|
|
|
>_ : Combinators
|
|
|
|
>map : { <T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>; <T>(c: Collection<T>, f: (x: T) => any): Collection<any>; }
|
|
|
|
>c2 : Collection<number>
|
|
|
|
>(x) => { return x.toFixed() } : (x: number) => string
|
|
|
|
>x : number
|
|
|
|
>x.toFixed() : string
|
|
|
|
>x.toFixed : (fractionDigits?: number) => string
|
|
|
|
>x : number
|
|
|
|
>toFixed : (fractionDigits?: number) => string
|
|
|
|
|
|
|
|
var r1b = _.map(c2, rf1); // this line should not cause the following 2 to have errors
|
|
|
|
>r1b : Collection<string>
|
|
|
|
>_.map(c2, rf1) : Collection<string>
|
|
|
|
>_.map : { <T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>; <T>(c: Collection<T>, f: (x: T) => any): Collection<any>; }
|
|
|
|
>_ : Combinators
|
|
|
|
>map : { <T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>; <T>(c: Collection<T>, f: (x: T) => any): Collection<any>; }
|
|
|
|
>c2 : Collection<number>
|
|
|
|
>rf1 : (x: number) => string
|
|
|
|
|
|
|
|
var r5a = _.map<number, string>(c2, (x) => { return x.toFixed() });
|
|
|
|
>r5a : Collection<string>
|
|
|
|
>_.map<number, string>(c2, (x) => { return x.toFixed() }) : Collection<string>
|
|
|
|
>_.map : { <T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>; <T>(c: Collection<T>, f: (x: T) => any): Collection<any>; }
|
|
|
|
>_ : Combinators
|
|
|
|
>map : { <T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>; <T>(c: Collection<T>, f: (x: T) => any): Collection<any>; }
|
|
|
|
>c2 : Collection<number>
|
|
|
|
>(x) => { return x.toFixed() } : (x: number) => string
|
|
|
|
>x : number
|
|
|
|
>x.toFixed() : string
|
|
|
|
>x.toFixed : (fractionDigits?: number) => string
|
|
|
|
>x : number
|
|
|
|
>toFixed : (fractionDigits?: number) => string
|
|
|
|
|
|
|
|
var r5b = _.map<number, string>(c2, rf1);
|
|
|
|
>r5b : Collection<string>
|
|
|
|
>_.map<number, string>(c2, rf1) : Collection<string>
|
|
|
|
>_.map : { <T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>; <T>(c: Collection<T>, f: (x: T) => any): Collection<any>; }
|
|
|
|
>_ : Combinators
|
|
|
|
>map : { <T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>; <T>(c: Collection<T>, f: (x: T) => any): Collection<any>; }
|
|
|
|
>c2 : Collection<number>
|
|
|
|
>rf1 : (x: number) => string
|
|
|
|
|