File: genericCallWithConstructorTypedArguments5.symbols

package info (click to toggle)
node-typescript 4.9.5%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 533,908 kB
  • sloc: javascript: 2,018,330; makefile: 7; sh: 1
file content (100 lines) | stat: -rw-r--r-- 5,818 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
93
94
95
96
97
98
99
100
=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstructorTypedArguments5.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: new(t: T) => U }) {
>foo : Symbol(foo, Decl(genericCallWithConstructorTypedArguments5.ts, 0, 0))
>T : Symbol(T, Decl(genericCallWithConstructorTypedArguments5.ts, 2, 13))
>U : Symbol(U, Decl(genericCallWithConstructorTypedArguments5.ts, 2, 15))
>arg : Symbol(arg, Decl(genericCallWithConstructorTypedArguments5.ts, 2, 19))
>cb : Symbol(cb, Decl(genericCallWithConstructorTypedArguments5.ts, 2, 25))
>t : Symbol(t, Decl(genericCallWithConstructorTypedArguments5.ts, 2, 34))
>T : Symbol(T, Decl(genericCallWithConstructorTypedArguments5.ts, 2, 13))
>U : Symbol(U, Decl(genericCallWithConstructorTypedArguments5.ts, 2, 15))

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

var arg: { cb: new<T>(x: T) => string };
>arg : Symbol(arg, Decl(genericCallWithConstructorTypedArguments5.ts, 6, 3))
>cb : Symbol(cb, Decl(genericCallWithConstructorTypedArguments5.ts, 6, 10))
>T : Symbol(T, Decl(genericCallWithConstructorTypedArguments5.ts, 6, 19))
>x : Symbol(x, Decl(genericCallWithConstructorTypedArguments5.ts, 6, 22))
>T : Symbol(T, Decl(genericCallWithConstructorTypedArguments5.ts, 6, 19))

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

// more args not allowed
var arg2: { cb: new <T>(x: T, y: T) => string };
>arg2 : Symbol(arg2, Decl(genericCallWithConstructorTypedArguments5.ts, 9, 3))
>cb : Symbol(cb, Decl(genericCallWithConstructorTypedArguments5.ts, 9, 11))
>T : Symbol(T, Decl(genericCallWithConstructorTypedArguments5.ts, 9, 21))
>x : Symbol(x, Decl(genericCallWithConstructorTypedArguments5.ts, 9, 24))
>T : Symbol(T, Decl(genericCallWithConstructorTypedArguments5.ts, 9, 21))
>y : Symbol(y, Decl(genericCallWithConstructorTypedArguments5.ts, 9, 29))
>T : Symbol(T, Decl(genericCallWithConstructorTypedArguments5.ts, 9, 21))

var r2 = foo(arg2); // error
>r2 : Symbol(r2, Decl(genericCallWithConstructorTypedArguments5.ts, 10, 3))
>foo : Symbol(foo, Decl(genericCallWithConstructorTypedArguments5.ts, 0, 0))
>arg2 : Symbol(arg2, Decl(genericCallWithConstructorTypedArguments5.ts, 9, 3))

var arg3: { cb: new (x: string, y: number) => string };
>arg3 : Symbol(arg3, Decl(genericCallWithConstructorTypedArguments5.ts, 11, 3))
>cb : Symbol(cb, Decl(genericCallWithConstructorTypedArguments5.ts, 11, 11))
>x : Symbol(x, Decl(genericCallWithConstructorTypedArguments5.ts, 11, 21))
>y : Symbol(y, Decl(genericCallWithConstructorTypedArguments5.ts, 11, 31))

var r3 = foo(arg3); // error
>r3 : Symbol(r3, Decl(genericCallWithConstructorTypedArguments5.ts, 12, 3))
>foo : Symbol(foo, Decl(genericCallWithConstructorTypedArguments5.ts, 0, 0))
>arg3 : Symbol(arg3, Decl(genericCallWithConstructorTypedArguments5.ts, 11, 3))

function foo2<T, U>(arg: { cb: new(t: T, t2: T) => U }) {
>foo2 : Symbol(foo2, Decl(genericCallWithConstructorTypedArguments5.ts, 12, 19))
>T : Symbol(T, Decl(genericCallWithConstructorTypedArguments5.ts, 14, 14))
>U : Symbol(U, Decl(genericCallWithConstructorTypedArguments5.ts, 14, 16))
>arg : Symbol(arg, Decl(genericCallWithConstructorTypedArguments5.ts, 14, 20))
>cb : Symbol(cb, Decl(genericCallWithConstructorTypedArguments5.ts, 14, 26))
>t : Symbol(t, Decl(genericCallWithConstructorTypedArguments5.ts, 14, 35))
>T : Symbol(T, Decl(genericCallWithConstructorTypedArguments5.ts, 14, 14))
>t2 : Symbol(t2, Decl(genericCallWithConstructorTypedArguments5.ts, 14, 40))
>T : Symbol(T, Decl(genericCallWithConstructorTypedArguments5.ts, 14, 14))
>U : Symbol(U, Decl(genericCallWithConstructorTypedArguments5.ts, 14, 16))

    return new arg.cb(null, null);
>arg.cb : Symbol(cb, Decl(genericCallWithConstructorTypedArguments5.ts, 14, 26))
>arg : Symbol(arg, Decl(genericCallWithConstructorTypedArguments5.ts, 14, 20))
>cb : Symbol(cb, Decl(genericCallWithConstructorTypedArguments5.ts, 14, 26))
}

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

var arg4: { cb: new (x: string) => string };
>arg4 : Symbol(arg4, Decl(genericCallWithConstructorTypedArguments5.ts, 20, 3))
>cb : Symbol(cb, Decl(genericCallWithConstructorTypedArguments5.ts, 20, 11))
>x : Symbol(x, Decl(genericCallWithConstructorTypedArguments5.ts, 20, 21))

var r6 = foo(arg4); // string
>r6 : Symbol(r6, Decl(genericCallWithConstructorTypedArguments5.ts, 21, 3))
>foo : Symbol(foo, Decl(genericCallWithConstructorTypedArguments5.ts, 0, 0))
>arg4 : Symbol(arg4, Decl(genericCallWithConstructorTypedArguments5.ts, 20, 3))

var arg5: { cb: new () => string };
>arg5 : Symbol(arg5, Decl(genericCallWithConstructorTypedArguments5.ts, 22, 3))
>cb : Symbol(cb, Decl(genericCallWithConstructorTypedArguments5.ts, 22, 11))

var r7 = foo(arg5); // string
>r7 : Symbol(r7, Decl(genericCallWithConstructorTypedArguments5.ts, 23, 3))
>foo : Symbol(foo, Decl(genericCallWithConstructorTypedArguments5.ts, 0, 0))
>arg5 : Symbol(arg5, Decl(genericCallWithConstructorTypedArguments5.ts, 22, 3))