File: genericCallWithConstraintsTypeArgumentInference2.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 (45 lines) | stat: -rw-r--r-- 2,834 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
=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts ===
// Generic call with parameters of T and U, U extends T, no parameter of type U

function foo<T, U extends T>(t: T) {
>foo : Symbol(foo, Decl(genericCallWithConstraintsTypeArgumentInference2.ts, 0, 0))
>T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference2.ts, 2, 13))
>U : Symbol(U, Decl(genericCallWithConstraintsTypeArgumentInference2.ts, 2, 15))
>T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference2.ts, 2, 13))
>t : Symbol(t, Decl(genericCallWithConstraintsTypeArgumentInference2.ts, 2, 29))
>T : Symbol(T, Decl(genericCallWithConstraintsTypeArgumentInference2.ts, 2, 13))

    var u: U;
>u : Symbol(u, Decl(genericCallWithConstraintsTypeArgumentInference2.ts, 3, 7))
>U : Symbol(U, Decl(genericCallWithConstraintsTypeArgumentInference2.ts, 2, 15))

    return u;
>u : Symbol(u, Decl(genericCallWithConstraintsTypeArgumentInference2.ts, 3, 7))
}

var r = foo(1); // ok
>r : Symbol(r, Decl(genericCallWithConstraintsTypeArgumentInference2.ts, 7, 3))
>foo : Symbol(foo, Decl(genericCallWithConstraintsTypeArgumentInference2.ts, 0, 0))

var r2 = foo(null); // {}
>r2 : Symbol(r2, Decl(genericCallWithConstraintsTypeArgumentInference2.ts, 8, 3))
>foo : Symbol(foo, Decl(genericCallWithConstraintsTypeArgumentInference2.ts, 0, 0))

var r3 = foo(new Object()); // {}
>r3 : Symbol(r3, Decl(genericCallWithConstraintsTypeArgumentInference2.ts, 9, 3))
>foo : Symbol(foo, Decl(genericCallWithConstraintsTypeArgumentInference2.ts, 0, 0))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

var r4 = foo<Date, Date>(1); // error
>r4 : Symbol(r4, Decl(genericCallWithConstraintsTypeArgumentInference2.ts, 10, 3))
>foo : Symbol(foo, Decl(genericCallWithConstraintsTypeArgumentInference2.ts, 0, 0))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))

var r5 = foo<Date, Date>(new Date()); // no error
>r5 : Symbol(r5, Decl(genericCallWithConstraintsTypeArgumentInference2.ts, 11, 3))
>foo : Symbol(foo, Decl(genericCallWithConstraintsTypeArgumentInference2.ts, 0, 0))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))