File: genericCallWithObjectTypeArgsAndIndexersErrors.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 (76 lines) | stat: -rw-r--r-- 3,923 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
=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndIndexersErrors.ts ===
// Type inference infers from indexers in target type, error cases

function foo<T>(x: T) {
>foo : Symbol(foo, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 0, 0))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 2, 13))
>x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 2, 16))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 2, 13))

    return x;
>x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 2, 16))
}

function other<T>(arg: T) {
>other : Symbol(other, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 4, 1))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 6, 15))
>arg : Symbol(arg, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 6, 18))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 6, 15))

    var b: {
>b : Symbol(b, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 7, 7))

        [x: string]: Object;
>x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 8, 9))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

        [x: number]: T; // ok, T is a subtype of Object because its apparent type is {}
>x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 9, 9))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 6, 15))

    };
    var r2 = foo(b); // T
>r2 : Symbol(r2, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 11, 7))
>foo : Symbol(foo, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 0, 0))
>b : Symbol(b, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 7, 7))
}

function other3<T extends U, U extends Date>(arg: T) {
>other3 : Symbol(other3, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 12, 1))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 14, 16))
>U : Symbol(U, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 14, 28))
>U : Symbol(U, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 14, 28))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))
>arg : Symbol(arg, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 14, 45))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 14, 16))

    var b: {
>b : Symbol(b, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 15, 7))

        [x: string]: Object;
>x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 16, 9))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

        [x: number]: T;
>x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 17, 9))
>T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 14, 16))

    };
    var r2 = foo(b);
>r2 : Symbol(r2, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 19, 7))
>foo : Symbol(foo, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 0, 0))
>b : Symbol(b, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 15, 7))

    var d = r2[1];
>d : Symbol(d, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 20, 7))
>r2 : Symbol(r2, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 19, 7))

    var e = r2['1'];
>e : Symbol(e, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 21, 7))
>r2 : Symbol(r2, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 19, 7))

    var u: U = r2[1]; // ok
>u : Symbol(u, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 22, 7))
>U : Symbol(U, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 14, 28))
>r2 : Symbol(r2, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 19, 7))
}