File: nonPrimitiveInGeneric.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 (113 lines) | stat: -rw-r--r-- 4,028 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
101
102
103
104
105
106
107
108
109
110
111
112
113
=== tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts ===
function generic<T>(t: T) {
>generic : Symbol(generic, Decl(nonPrimitiveInGeneric.ts, 0, 0))
>T : Symbol(T, Decl(nonPrimitiveInGeneric.ts, 0, 17))
>t : Symbol(t, Decl(nonPrimitiveInGeneric.ts, 0, 20))
>T : Symbol(T, Decl(nonPrimitiveInGeneric.ts, 0, 17))

    var o: object = t; // expect error
>o : Symbol(o, Decl(nonPrimitiveInGeneric.ts, 1, 7))
>t : Symbol(t, Decl(nonPrimitiveInGeneric.ts, 0, 20))
}
var a = {};
>a : Symbol(a, Decl(nonPrimitiveInGeneric.ts, 3, 3))

var b = "42";
>b : Symbol(b, Decl(nonPrimitiveInGeneric.ts, 4, 3))

generic<object>({});
>generic : Symbol(generic, Decl(nonPrimitiveInGeneric.ts, 0, 0))

generic<object>(a);
>generic : Symbol(generic, Decl(nonPrimitiveInGeneric.ts, 0, 0))
>a : Symbol(a, Decl(nonPrimitiveInGeneric.ts, 3, 3))

generic<object>(123); // expect error
>generic : Symbol(generic, Decl(nonPrimitiveInGeneric.ts, 0, 0))

generic<object>(b); // expect error
>generic : Symbol(generic, Decl(nonPrimitiveInGeneric.ts, 0, 0))
>b : Symbol(b, Decl(nonPrimitiveInGeneric.ts, 4, 3))

function bound<T extends object>(t: T) {
>bound : Symbol(bound, Decl(nonPrimitiveInGeneric.ts, 9, 19))
>T : Symbol(T, Decl(nonPrimitiveInGeneric.ts, 11, 15))
>t : Symbol(t, Decl(nonPrimitiveInGeneric.ts, 11, 33))
>T : Symbol(T, Decl(nonPrimitiveInGeneric.ts, 11, 15))

    var o: object = t; // ok
>o : Symbol(o, Decl(nonPrimitiveInGeneric.ts, 12, 7))
>t : Symbol(t, Decl(nonPrimitiveInGeneric.ts, 11, 33))
}

bound({});
>bound : Symbol(bound, Decl(nonPrimitiveInGeneric.ts, 9, 19))

bound(a);
>bound : Symbol(bound, Decl(nonPrimitiveInGeneric.ts, 9, 19))
>a : Symbol(a, Decl(nonPrimitiveInGeneric.ts, 3, 3))

bound(123); // expect error
>bound : Symbol(bound, Decl(nonPrimitiveInGeneric.ts, 9, 19))

bound(b); // expect error
>bound : Symbol(bound, Decl(nonPrimitiveInGeneric.ts, 9, 19))
>b : Symbol(b, Decl(nonPrimitiveInGeneric.ts, 4, 3))

function bound2<T extends object>() {}
>bound2 : Symbol(bound2, Decl(nonPrimitiveInGeneric.ts, 18, 9))
>T : Symbol(T, Decl(nonPrimitiveInGeneric.ts, 20, 16))

bound2<{}>();
>bound2 : Symbol(bound2, Decl(nonPrimitiveInGeneric.ts, 18, 9))

bound2<Object>();
>bound2 : Symbol(bound2, Decl(nonPrimitiveInGeneric.ts, 18, 9))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

bound2<number>(); // expect error
>bound2 : Symbol(bound2, Decl(nonPrimitiveInGeneric.ts, 18, 9))

bound2<string>(); // expect error
>bound2 : Symbol(bound2, Decl(nonPrimitiveInGeneric.ts, 18, 9))

function bound3<T extends {}>(t: T) {
>bound3 : Symbol(bound3, Decl(nonPrimitiveInGeneric.ts, 25, 17))
>T : Symbol(T, Decl(nonPrimitiveInGeneric.ts, 27, 16))
>t : Symbol(t, Decl(nonPrimitiveInGeneric.ts, 27, 30))
>T : Symbol(T, Decl(nonPrimitiveInGeneric.ts, 27, 16))

    var o: object = t; // ok
>o : Symbol(o, Decl(nonPrimitiveInGeneric.ts, 28, 7))
>t : Symbol(t, Decl(nonPrimitiveInGeneric.ts, 27, 30))
}

interface Proxy<T extends object> {}
>Proxy : Symbol(Proxy, Decl(nonPrimitiveInGeneric.ts, 29, 1))
>T : Symbol(T, Decl(nonPrimitiveInGeneric.ts, 31, 16))

var x: Proxy<number>; // error
>x : Symbol(x, Decl(nonPrimitiveInGeneric.ts, 33, 3))
>Proxy : Symbol(Proxy, Decl(nonPrimitiveInGeneric.ts, 29, 1))

var y: Proxy<null>; // ok
>y : Symbol(y, Decl(nonPrimitiveInGeneric.ts, 34, 3))
>Proxy : Symbol(Proxy, Decl(nonPrimitiveInGeneric.ts, 29, 1))

var z: Proxy<undefined> ; // ok
>z : Symbol(z, Decl(nonPrimitiveInGeneric.ts, 35, 3))
>Proxy : Symbol(Proxy, Decl(nonPrimitiveInGeneric.ts, 29, 1))


interface Blah {
>Blah : Symbol(Blah, Decl(nonPrimitiveInGeneric.ts, 35, 25))

    foo: number;
>foo : Symbol(Blah.foo, Decl(nonPrimitiveInGeneric.ts, 38, 16))
}

var u: Proxy<Blah>; // ok
>u : Symbol(u, Decl(nonPrimitiveInGeneric.ts, 42, 3))
>Proxy : Symbol(Proxy, Decl(nonPrimitiveInGeneric.ts, 29, 1))
>Blah : Symbol(Blah, Decl(nonPrimitiveInGeneric.ts, 35, 25))