File: genericCallWithObjectTypeArgsAndConstraints5.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 (69 lines) | stat: -rw-r--r-- 3,518 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
=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints5.ts ===
// Generic call with constraints infering type parameter from object member properties

class C {
>C : Symbol(C, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 0, 0))

    x: string;
>x : Symbol(C.x, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 2, 9))
}

class D {
>D : Symbol(D, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 4, 1))

    x: string;
>x : Symbol(D.x, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 6, 9))

    y: string;
>y : Symbol(D.y, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 7, 14))
}

function foo<T, U extends T>(t: T, t2: U) {
>foo : Symbol(foo, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 9, 1))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 11, 13))
>U : Symbol(U, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 11, 15))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 11, 13))
>t : Symbol(t, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 11, 29))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 11, 13))
>t2 : Symbol(t2, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 11, 34))
>U : Symbol(U, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 11, 15))

    return (x: T) => t2;
>x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 12, 12))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 11, 13))
>t2 : Symbol(t2, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 11, 34))
}

var c: C;
>c : Symbol(c, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 15, 3))
>C : Symbol(C, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 0, 0))

var d: D;
>d : Symbol(d, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 16, 3))
>D : Symbol(D, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 4, 1))

var r2 = foo(d, c); // the constraints are self-referencing, no downstream error
>r2 : Symbol(r2, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 17, 3))
>foo : Symbol(foo, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 9, 1))
>d : Symbol(d, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 16, 3))
>c : Symbol(c, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 15, 3))

var r9 = foo(() => 1, () => { }); // the constraints are self-referencing, no downstream error
>r9 : Symbol(r9, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 18, 3))
>foo : Symbol(foo, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 9, 1))

function other<T, U extends T>() {
>other : Symbol(other, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 18, 33))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 20, 15))
>U : Symbol(U, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 20, 17))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 20, 15))

    var r5 = foo<T, U>(c, d); // error
>r5 : Symbol(r5, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 21, 7))
>foo : Symbol(foo, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 9, 1))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 20, 15))
>U : Symbol(U, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 20, 17))
>c : Symbol(c, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 15, 3))
>d : Symbol(d, Decl(genericCallWithObjectTypeArgsAndConstraints5.ts, 16, 3))
}