141 lines
7.7 KiB
Text
141 lines
7.7 KiB
Text
=== tests/cases/compiler/lambdaParamTypes.ts ===
|
|
interface MyArrayWrapper<T> {
|
|
>MyArrayWrapper : Symbol(MyArrayWrapper, Decl(lambdaParamTypes.ts, 0, 0))
|
|
>T : Symbol(T, Decl(lambdaParamTypes.ts, 0, 25))
|
|
|
|
constructor(initialItems?: T[]);
|
|
>constructor : Symbol(MyArrayWrapper.constructor, Decl(lambdaParamTypes.ts, 0, 29))
|
|
>initialItems : Symbol(initialItems, Decl(lambdaParamTypes.ts, 1, 16))
|
|
>T : Symbol(T, Decl(lambdaParamTypes.ts, 0, 25))
|
|
|
|
doSomething(predicate: (x: T, y: T) => string): void;
|
|
>doSomething : Symbol(MyArrayWrapper.doSomething, Decl(lambdaParamTypes.ts, 1, 36))
|
|
>predicate : Symbol(predicate, Decl(lambdaParamTypes.ts, 2, 16))
|
|
>x : Symbol(x, Decl(lambdaParamTypes.ts, 2, 28))
|
|
>T : Symbol(T, Decl(lambdaParamTypes.ts, 0, 25))
|
|
>y : Symbol(y, Decl(lambdaParamTypes.ts, 2, 33))
|
|
>T : Symbol(T, Decl(lambdaParamTypes.ts, 0, 25))
|
|
}
|
|
|
|
declare function create<T>(initialValues?: T[]): MyArrayWrapper<T>;
|
|
>create : Symbol(create, Decl(lambdaParamTypes.ts, 3, 1))
|
|
>T : Symbol(T, Decl(lambdaParamTypes.ts, 5, 24))
|
|
>initialValues : Symbol(initialValues, Decl(lambdaParamTypes.ts, 5, 27))
|
|
>T : Symbol(T, Decl(lambdaParamTypes.ts, 5, 24))
|
|
>MyArrayWrapper : Symbol(MyArrayWrapper, Decl(lambdaParamTypes.ts, 0, 0))
|
|
>T : Symbol(T, Decl(lambdaParamTypes.ts, 5, 24))
|
|
|
|
var thing = create([{ name: "bob", id: 24 }, { name: "doug", id: 32 }]);
|
|
>thing : Symbol(thing, Decl(lambdaParamTypes.ts, 7, 3))
|
|
>create : Symbol(create, Decl(lambdaParamTypes.ts, 3, 1))
|
|
>name : Symbol(name, Decl(lambdaParamTypes.ts, 7, 21))
|
|
>id : Symbol(id, Decl(lambdaParamTypes.ts, 7, 34))
|
|
>name : Symbol(name, Decl(lambdaParamTypes.ts, 7, 46))
|
|
>id : Symbol(id, Decl(lambdaParamTypes.ts, 7, 60))
|
|
|
|
// Below should all be OK
|
|
thing.doSomething((x, y) => x.name.charAt(0)); // x.name should be string, so should be OK
|
|
>thing.doSomething : Symbol(MyArrayWrapper.doSomething, Decl(lambdaParamTypes.ts, 1, 36))
|
|
>thing : Symbol(thing, Decl(lambdaParamTypes.ts, 7, 3))
|
|
>doSomething : Symbol(MyArrayWrapper.doSomething, Decl(lambdaParamTypes.ts, 1, 36))
|
|
>x : Symbol(x, Decl(lambdaParamTypes.ts, 10, 19))
|
|
>y : Symbol(y, Decl(lambdaParamTypes.ts, 10, 21))
|
|
>x.name.charAt : Symbol(String.charAt, Decl(lib.es5.d.ts, --, --))
|
|
>x.name : Symbol(name, Decl(lambdaParamTypes.ts, 7, 21))
|
|
>x : Symbol(x, Decl(lambdaParamTypes.ts, 10, 19))
|
|
>name : Symbol(name, Decl(lambdaParamTypes.ts, 7, 21))
|
|
>charAt : Symbol(String.charAt, Decl(lib.es5.d.ts, --, --))
|
|
|
|
thing.doSomething((x, y) => x.id.toExponential(0)); // x.id should be string, so should be OK
|
|
>thing.doSomething : Symbol(MyArrayWrapper.doSomething, Decl(lambdaParamTypes.ts, 1, 36))
|
|
>thing : Symbol(thing, Decl(lambdaParamTypes.ts, 7, 3))
|
|
>doSomething : Symbol(MyArrayWrapper.doSomething, Decl(lambdaParamTypes.ts, 1, 36))
|
|
>x : Symbol(x, Decl(lambdaParamTypes.ts, 11, 19))
|
|
>y : Symbol(y, Decl(lambdaParamTypes.ts, 11, 21))
|
|
>x.id.toExponential : Symbol(Number.toExponential, Decl(lib.es5.d.ts, --, --))
|
|
>x.id : Symbol(id, Decl(lambdaParamTypes.ts, 7, 34))
|
|
>x : Symbol(x, Decl(lambdaParamTypes.ts, 11, 19))
|
|
>id : Symbol(id, Decl(lambdaParamTypes.ts, 7, 34))
|
|
>toExponential : Symbol(Number.toExponential, Decl(lib.es5.d.ts, --, --))
|
|
|
|
thing.doSomething((x, y) => y.name.charAt(0)); // x.name should be string, so should be OK
|
|
>thing.doSomething : Symbol(MyArrayWrapper.doSomething, Decl(lambdaParamTypes.ts, 1, 36))
|
|
>thing : Symbol(thing, Decl(lambdaParamTypes.ts, 7, 3))
|
|
>doSomething : Symbol(MyArrayWrapper.doSomething, Decl(lambdaParamTypes.ts, 1, 36))
|
|
>x : Symbol(x, Decl(lambdaParamTypes.ts, 12, 19))
|
|
>y : Symbol(y, Decl(lambdaParamTypes.ts, 12, 21))
|
|
>y.name.charAt : Symbol(String.charAt, Decl(lib.es5.d.ts, --, --))
|
|
>y.name : Symbol(name, Decl(lambdaParamTypes.ts, 7, 21))
|
|
>y : Symbol(y, Decl(lambdaParamTypes.ts, 12, 21))
|
|
>name : Symbol(name, Decl(lambdaParamTypes.ts, 7, 21))
|
|
>charAt : Symbol(String.charAt, Decl(lib.es5.d.ts, --, --))
|
|
|
|
thing.doSomething((x, y) => y.id.toExponential(0)); // x.id should be string, so should be OK
|
|
>thing.doSomething : Symbol(MyArrayWrapper.doSomething, Decl(lambdaParamTypes.ts, 1, 36))
|
|
>thing : Symbol(thing, Decl(lambdaParamTypes.ts, 7, 3))
|
|
>doSomething : Symbol(MyArrayWrapper.doSomething, Decl(lambdaParamTypes.ts, 1, 36))
|
|
>x : Symbol(x, Decl(lambdaParamTypes.ts, 13, 19))
|
|
>y : Symbol(y, Decl(lambdaParamTypes.ts, 13, 21))
|
|
>y.id.toExponential : Symbol(Number.toExponential, Decl(lib.es5.d.ts, --, --))
|
|
>y.id : Symbol(id, Decl(lambdaParamTypes.ts, 7, 34))
|
|
>y : Symbol(y, Decl(lambdaParamTypes.ts, 13, 21))
|
|
>id : Symbol(id, Decl(lambdaParamTypes.ts, 7, 34))
|
|
>toExponential : Symbol(Number.toExponential, Decl(lib.es5.d.ts, --, --))
|
|
|
|
// Below should all be in error
|
|
thing.doSomething((x, y) => x.foo); // no such property on x
|
|
>thing.doSomething : Symbol(MyArrayWrapper.doSomething, Decl(lambdaParamTypes.ts, 1, 36))
|
|
>thing : Symbol(thing, Decl(lambdaParamTypes.ts, 7, 3))
|
|
>doSomething : Symbol(MyArrayWrapper.doSomething, Decl(lambdaParamTypes.ts, 1, 36))
|
|
>x : Symbol(x, Decl(lambdaParamTypes.ts, 16, 19))
|
|
>y : Symbol(y, Decl(lambdaParamTypes.ts, 16, 21))
|
|
>x : Symbol(x, Decl(lambdaParamTypes.ts, 16, 19))
|
|
|
|
thing.doSomething((x, y) => y.foo); // no such property on y
|
|
>thing.doSomething : Symbol(MyArrayWrapper.doSomething, Decl(lambdaParamTypes.ts, 1, 36))
|
|
>thing : Symbol(thing, Decl(lambdaParamTypes.ts, 7, 3))
|
|
>doSomething : Symbol(MyArrayWrapper.doSomething, Decl(lambdaParamTypes.ts, 1, 36))
|
|
>x : Symbol(x, Decl(lambdaParamTypes.ts, 17, 19))
|
|
>y : Symbol(y, Decl(lambdaParamTypes.ts, 17, 21))
|
|
>y : Symbol(y, Decl(lambdaParamTypes.ts, 17, 21))
|
|
|
|
thing.doSomething((x, y) => x.id.charAt(0)); // x.id should be number, no charAt member
|
|
>thing.doSomething : Symbol(MyArrayWrapper.doSomething, Decl(lambdaParamTypes.ts, 1, 36))
|
|
>thing : Symbol(thing, Decl(lambdaParamTypes.ts, 7, 3))
|
|
>doSomething : Symbol(MyArrayWrapper.doSomething, Decl(lambdaParamTypes.ts, 1, 36))
|
|
>x : Symbol(x, Decl(lambdaParamTypes.ts, 18, 19))
|
|
>y : Symbol(y, Decl(lambdaParamTypes.ts, 18, 21))
|
|
>x.id : Symbol(id, Decl(lambdaParamTypes.ts, 7, 34))
|
|
>x : Symbol(x, Decl(lambdaParamTypes.ts, 18, 19))
|
|
>id : Symbol(id, Decl(lambdaParamTypes.ts, 7, 34))
|
|
|
|
thing.doSomething((x, y) => x.name.toExponential(0)); // x.name should be string, no toExponential member
|
|
>thing.doSomething : Symbol(MyArrayWrapper.doSomething, Decl(lambdaParamTypes.ts, 1, 36))
|
|
>thing : Symbol(thing, Decl(lambdaParamTypes.ts, 7, 3))
|
|
>doSomething : Symbol(MyArrayWrapper.doSomething, Decl(lambdaParamTypes.ts, 1, 36))
|
|
>x : Symbol(x, Decl(lambdaParamTypes.ts, 19, 19))
|
|
>y : Symbol(y, Decl(lambdaParamTypes.ts, 19, 21))
|
|
>x.name : Symbol(name, Decl(lambdaParamTypes.ts, 7, 21))
|
|
>x : Symbol(x, Decl(lambdaParamTypes.ts, 19, 19))
|
|
>name : Symbol(name, Decl(lambdaParamTypes.ts, 7, 21))
|
|
|
|
thing.doSomething((x, y) => y.id.charAt(0));
|
|
>thing.doSomething : Symbol(MyArrayWrapper.doSomething, Decl(lambdaParamTypes.ts, 1, 36))
|
|
>thing : Symbol(thing, Decl(lambdaParamTypes.ts, 7, 3))
|
|
>doSomething : Symbol(MyArrayWrapper.doSomething, Decl(lambdaParamTypes.ts, 1, 36))
|
|
>x : Symbol(x, Decl(lambdaParamTypes.ts, 20, 19))
|
|
>y : Symbol(y, Decl(lambdaParamTypes.ts, 20, 21))
|
|
>y.id : Symbol(id, Decl(lambdaParamTypes.ts, 7, 34))
|
|
>y : Symbol(y, Decl(lambdaParamTypes.ts, 20, 21))
|
|
>id : Symbol(id, Decl(lambdaParamTypes.ts, 7, 34))
|
|
|
|
thing.doSomething((x, y) => y.name.toExponential(0));
|
|
>thing.doSomething : Symbol(MyArrayWrapper.doSomething, Decl(lambdaParamTypes.ts, 1, 36))
|
|
>thing : Symbol(thing, Decl(lambdaParamTypes.ts, 7, 3))
|
|
>doSomething : Symbol(MyArrayWrapper.doSomething, Decl(lambdaParamTypes.ts, 1, 36))
|
|
>x : Symbol(x, Decl(lambdaParamTypes.ts, 21, 19))
|
|
>y : Symbol(y, Decl(lambdaParamTypes.ts, 21, 21))
|
|
>y.name : Symbol(name, Decl(lambdaParamTypes.ts, 7, 21))
|
|
>y : Symbol(y, Decl(lambdaParamTypes.ts, 21, 21))
|
|
>name : Symbol(name, Decl(lambdaParamTypes.ts, 7, 21))
|
|
|