1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
=== tests/cases/compiler/untypedFunctionCallsWithTypeParameters1.ts ===
// none of these function calls should be allowed
var x = function () { return; };
>x : Symbol(x, Decl(untypedFunctionCallsWithTypeParameters1.ts, 1, 3))
var r1 = x<number>();
>r1 : Symbol(r1, Decl(untypedFunctionCallsWithTypeParameters1.ts, 2, 3))
>x : Symbol(x, Decl(untypedFunctionCallsWithTypeParameters1.ts, 1, 3))
var y: any = x;
>y : Symbol(y, Decl(untypedFunctionCallsWithTypeParameters1.ts, 3, 3))
>x : Symbol(x, Decl(untypedFunctionCallsWithTypeParameters1.ts, 1, 3))
var r2 = y<string>();
>r2 : Symbol(r2, Decl(untypedFunctionCallsWithTypeParameters1.ts, 4, 3))
>y : Symbol(y, Decl(untypedFunctionCallsWithTypeParameters1.ts, 3, 3))
var c: Function;
>c : Symbol(c, Decl(untypedFunctionCallsWithTypeParameters1.ts, 6, 3))
>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
var r3 = c<number>(); // should be an error
>r3 : Symbol(r3, Decl(untypedFunctionCallsWithTypeParameters1.ts, 7, 3))
>c : Symbol(c, Decl(untypedFunctionCallsWithTypeParameters1.ts, 6, 3))
class C implements Function {
>C : Symbol(C, Decl(untypedFunctionCallsWithTypeParameters1.ts, 7, 21))
>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
prototype = null;
>prototype : Symbol(C.prototype, Decl(untypedFunctionCallsWithTypeParameters1.ts, 9, 29))
length = 1;
>length : Symbol(C.length, Decl(untypedFunctionCallsWithTypeParameters1.ts, 10, 21))
arguments = null;
>arguments : Symbol(C.arguments, Decl(untypedFunctionCallsWithTypeParameters1.ts, 11, 15))
caller = () => { };
>caller : Symbol(C.caller, Decl(untypedFunctionCallsWithTypeParameters1.ts, 12, 21))
}
var c2: C;
>c2 : Symbol(c2, Decl(untypedFunctionCallsWithTypeParameters1.ts, 16, 3))
>C : Symbol(C, Decl(untypedFunctionCallsWithTypeParameters1.ts, 7, 21))
var r4 = c2<number>(); // should be an error
>r4 : Symbol(r4, Decl(untypedFunctionCallsWithTypeParameters1.ts, 17, 3))
>c2 : Symbol(c2, Decl(untypedFunctionCallsWithTypeParameters1.ts, 16, 3))
class C2 extends Function { } // error
>C2 : Symbol(C2, Decl(untypedFunctionCallsWithTypeParameters1.ts, 17, 22))
>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
var c3: C2;
>c3 : Symbol(c3, Decl(untypedFunctionCallsWithTypeParameters1.ts, 20, 3))
>C2 : Symbol(C2, Decl(untypedFunctionCallsWithTypeParameters1.ts, 17, 22))
var r5 = c3<number>(); // error
>r5 : Symbol(r5, Decl(untypedFunctionCallsWithTypeParameters1.ts, 21, 3))
>c3 : Symbol(c3, Decl(untypedFunctionCallsWithTypeParameters1.ts, 20, 3))
interface I {
>I : Symbol(I, Decl(untypedFunctionCallsWithTypeParameters1.ts, 21, 22))
(number): number;
>number : Symbol(number, Decl(untypedFunctionCallsWithTypeParameters1.ts, 24, 5))
}
var z: I;
>z : Symbol(z, Decl(untypedFunctionCallsWithTypeParameters1.ts, 26, 3))
>I : Symbol(I, Decl(untypedFunctionCallsWithTypeParameters1.ts, 21, 22))
var r6 = z<string>(1); // error
>r6 : Symbol(r6, Decl(untypedFunctionCallsWithTypeParameters1.ts, 27, 3))
>z : Symbol(z, Decl(untypedFunctionCallsWithTypeParameters1.ts, 26, 3))
interface callable2<T> {
>callable2 : Symbol(callable2, Decl(untypedFunctionCallsWithTypeParameters1.ts, 27, 22))
>T : Symbol(T, Decl(untypedFunctionCallsWithTypeParameters1.ts, 29, 20))
(a: T): T;
>a : Symbol(a, Decl(untypedFunctionCallsWithTypeParameters1.ts, 30, 5))
>T : Symbol(T, Decl(untypedFunctionCallsWithTypeParameters1.ts, 29, 20))
>T : Symbol(T, Decl(untypedFunctionCallsWithTypeParameters1.ts, 29, 20))
}
var c4: callable2<number>;
>c4 : Symbol(c4, Decl(untypedFunctionCallsWithTypeParameters1.ts, 33, 3))
>callable2 : Symbol(callable2, Decl(untypedFunctionCallsWithTypeParameters1.ts, 27, 22))
c4<number>(1);
>c4 : Symbol(c4, Decl(untypedFunctionCallsWithTypeParameters1.ts, 33, 3))
interface callable3<T> {
>callable3 : Symbol(callable3, Decl(untypedFunctionCallsWithTypeParameters1.ts, 34, 14))
>T : Symbol(T, Decl(untypedFunctionCallsWithTypeParameters1.ts, 35, 20))
(a: T): T;
>a : Symbol(a, Decl(untypedFunctionCallsWithTypeParameters1.ts, 36, 5))
>T : Symbol(T, Decl(untypedFunctionCallsWithTypeParameters1.ts, 35, 20))
>T : Symbol(T, Decl(untypedFunctionCallsWithTypeParameters1.ts, 35, 20))
}
var c5: callable3<number>;
>c5 : Symbol(c5, Decl(untypedFunctionCallsWithTypeParameters1.ts, 39, 3))
>callable3 : Symbol(callable3, Decl(untypedFunctionCallsWithTypeParameters1.ts, 34, 14))
c5<string>(1); // error
>c5 : Symbol(c5, Decl(untypedFunctionCallsWithTypeParameters1.ts, 39, 3))
|