File: genericCallWithFunctionTypedArguments5.symbols

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (92 lines) | stat: -rw-r--r-- 5,366 bytes parent folder | download | duplicates (5)
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
=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments5.ts ===
// Generic call with parameter of object type with member of function type of n args passed object whose associated member is call signature with n+1 args

function foo<T, U>(arg: { cb: (t: T) => U }) {
>foo : Symbol(foo, Decl(genericCallWithFunctionTypedArguments5.ts, 0, 0))
>T : Symbol(T, Decl(genericCallWithFunctionTypedArguments5.ts, 2, 13))
>U : Symbol(U, Decl(genericCallWithFunctionTypedArguments5.ts, 2, 15))
>arg : Symbol(arg, Decl(genericCallWithFunctionTypedArguments5.ts, 2, 19))
>cb : Symbol(cb, Decl(genericCallWithFunctionTypedArguments5.ts, 2, 25))
>t : Symbol(t, Decl(genericCallWithFunctionTypedArguments5.ts, 2, 31))
>T : Symbol(T, Decl(genericCallWithFunctionTypedArguments5.ts, 2, 13))
>U : Symbol(U, Decl(genericCallWithFunctionTypedArguments5.ts, 2, 15))

    return arg.cb(null);
>arg.cb : Symbol(cb, Decl(genericCallWithFunctionTypedArguments5.ts, 2, 25))
>arg : Symbol(arg, Decl(genericCallWithFunctionTypedArguments5.ts, 2, 19))
>cb : Symbol(cb, Decl(genericCallWithFunctionTypedArguments5.ts, 2, 25))
}

var arg = { cb: <T>(x: T) => '' };
>arg : Symbol(arg, Decl(genericCallWithFunctionTypedArguments5.ts, 6, 3))
>cb : Symbol(cb, Decl(genericCallWithFunctionTypedArguments5.ts, 6, 11))
>T : Symbol(T, Decl(genericCallWithFunctionTypedArguments5.ts, 6, 17))
>x : Symbol(x, Decl(genericCallWithFunctionTypedArguments5.ts, 6, 20))
>T : Symbol(T, Decl(genericCallWithFunctionTypedArguments5.ts, 6, 17))

var r = foo(arg); // {}
>r : Symbol(r, Decl(genericCallWithFunctionTypedArguments5.ts, 7, 3))
>foo : Symbol(foo, Decl(genericCallWithFunctionTypedArguments5.ts, 0, 0))
>arg : Symbol(arg, Decl(genericCallWithFunctionTypedArguments5.ts, 6, 3))

// more args not allowed
var r2 = foo({ cb: <T>(x: T, y: T) => '' }); // error
>r2 : Symbol(r2, Decl(genericCallWithFunctionTypedArguments5.ts, 9, 3))
>foo : Symbol(foo, Decl(genericCallWithFunctionTypedArguments5.ts, 0, 0))
>cb : Symbol(cb, Decl(genericCallWithFunctionTypedArguments5.ts, 9, 14))
>T : Symbol(T, Decl(genericCallWithFunctionTypedArguments5.ts, 9, 20))
>x : Symbol(x, Decl(genericCallWithFunctionTypedArguments5.ts, 9, 23))
>T : Symbol(T, Decl(genericCallWithFunctionTypedArguments5.ts, 9, 20))
>y : Symbol(y, Decl(genericCallWithFunctionTypedArguments5.ts, 9, 28))
>T : Symbol(T, Decl(genericCallWithFunctionTypedArguments5.ts, 9, 20))

var r3 = foo({ cb: (x: string, y: number) => '' }); // error
>r3 : Symbol(r3, Decl(genericCallWithFunctionTypedArguments5.ts, 10, 3))
>foo : Symbol(foo, Decl(genericCallWithFunctionTypedArguments5.ts, 0, 0))
>cb : Symbol(cb, Decl(genericCallWithFunctionTypedArguments5.ts, 10, 14))
>x : Symbol(x, Decl(genericCallWithFunctionTypedArguments5.ts, 10, 20))
>y : Symbol(y, Decl(genericCallWithFunctionTypedArguments5.ts, 10, 30))

function foo2<T, U>(arg: { cb: (t: T, t2: T) => U }) {
>foo2 : Symbol(foo2, Decl(genericCallWithFunctionTypedArguments5.ts, 10, 51))
>T : Symbol(T, Decl(genericCallWithFunctionTypedArguments5.ts, 12, 14))
>U : Symbol(U, Decl(genericCallWithFunctionTypedArguments5.ts, 12, 16))
>arg : Symbol(arg, Decl(genericCallWithFunctionTypedArguments5.ts, 12, 20))
>cb : Symbol(cb, Decl(genericCallWithFunctionTypedArguments5.ts, 12, 26))
>t : Symbol(t, Decl(genericCallWithFunctionTypedArguments5.ts, 12, 32))
>T : Symbol(T, Decl(genericCallWithFunctionTypedArguments5.ts, 12, 14))
>t2 : Symbol(t2, Decl(genericCallWithFunctionTypedArguments5.ts, 12, 37))
>T : Symbol(T, Decl(genericCallWithFunctionTypedArguments5.ts, 12, 14))
>U : Symbol(U, Decl(genericCallWithFunctionTypedArguments5.ts, 12, 16))

    return arg.cb(null, null);
>arg.cb : Symbol(cb, Decl(genericCallWithFunctionTypedArguments5.ts, 12, 26))
>arg : Symbol(arg, Decl(genericCallWithFunctionTypedArguments5.ts, 12, 20))
>cb : Symbol(cb, Decl(genericCallWithFunctionTypedArguments5.ts, 12, 26))
}

// fewer args ok
var r4 = foo(arg); // {}
>r4 : Symbol(r4, Decl(genericCallWithFunctionTypedArguments5.ts, 17, 3))
>foo : Symbol(foo, Decl(genericCallWithFunctionTypedArguments5.ts, 0, 0))
>arg : Symbol(arg, Decl(genericCallWithFunctionTypedArguments5.ts, 6, 3))

var r5 = foo({ cb: <T>(x: T) => '' }); // {}
>r5 : Symbol(r5, Decl(genericCallWithFunctionTypedArguments5.ts, 18, 3))
>foo : Symbol(foo, Decl(genericCallWithFunctionTypedArguments5.ts, 0, 0))
>cb : Symbol(cb, Decl(genericCallWithFunctionTypedArguments5.ts, 18, 14))
>T : Symbol(T, Decl(genericCallWithFunctionTypedArguments5.ts, 18, 20))
>x : Symbol(x, Decl(genericCallWithFunctionTypedArguments5.ts, 18, 23))
>T : Symbol(T, Decl(genericCallWithFunctionTypedArguments5.ts, 18, 20))

var r6 = foo({ cb: (x: string) => '' }); // string
>r6 : Symbol(r6, Decl(genericCallWithFunctionTypedArguments5.ts, 19, 3))
>foo : Symbol(foo, Decl(genericCallWithFunctionTypedArguments5.ts, 0, 0))
>cb : Symbol(cb, Decl(genericCallWithFunctionTypedArguments5.ts, 19, 14))
>x : Symbol(x, Decl(genericCallWithFunctionTypedArguments5.ts, 19, 20))

var r7 = foo({ cb: () => '' }); // string
>r7 : Symbol(r7, Decl(genericCallWithFunctionTypedArguments5.ts, 20, 3))
>foo : Symbol(foo, Decl(genericCallWithFunctionTypedArguments5.ts, 0, 0))
>cb : Symbol(cb, Decl(genericCallWithFunctionTypedArguments5.ts, 20, 14))