File: recursiveTypeInGenericConstraint.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 (39 lines) | stat: -rw-r--r-- 1,802 bytes parent folder | download | duplicates (7)
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
=== tests/cases/conformance/types/typeRelationships/recursiveTypes/recursiveTypeInGenericConstraint.ts ===
class G<T> {
>G : Symbol(G, Decl(recursiveTypeInGenericConstraint.ts, 0, 0))
>T : Symbol(T, Decl(recursiveTypeInGenericConstraint.ts, 0, 8))

    x: G<G<T>>; // infinitely expanding type reference
>x : Symbol(G.x, Decl(recursiveTypeInGenericConstraint.ts, 0, 12))
>G : Symbol(G, Decl(recursiveTypeInGenericConstraint.ts, 0, 0))
>G : Symbol(G, Decl(recursiveTypeInGenericConstraint.ts, 0, 0))
>T : Symbol(T, Decl(recursiveTypeInGenericConstraint.ts, 0, 8))
}

class Foo<T extends G<T>> { // error, constraint referencing itself
>Foo : Symbol(Foo, Decl(recursiveTypeInGenericConstraint.ts, 2, 1))
>T : Symbol(T, Decl(recursiveTypeInGenericConstraint.ts, 4, 10))
>G : Symbol(G, Decl(recursiveTypeInGenericConstraint.ts, 0, 0))
>T : Symbol(T, Decl(recursiveTypeInGenericConstraint.ts, 4, 10))

    bar: T;
>bar : Symbol(Foo.bar, Decl(recursiveTypeInGenericConstraint.ts, 4, 27))
>T : Symbol(T, Decl(recursiveTypeInGenericConstraint.ts, 4, 10))
}

class D<T> {
>D : Symbol(D, Decl(recursiveTypeInGenericConstraint.ts, 6, 1))
>T : Symbol(T, Decl(recursiveTypeInGenericConstraint.ts, 8, 8))

    x: G<G<T>>; 
>x : Symbol(D.x, Decl(recursiveTypeInGenericConstraint.ts, 8, 12))
>G : Symbol(G, Decl(recursiveTypeInGenericConstraint.ts, 0, 0))
>G : Symbol(G, Decl(recursiveTypeInGenericConstraint.ts, 0, 0))
>T : Symbol(T, Decl(recursiveTypeInGenericConstraint.ts, 8, 8))
}

var c1 = new Foo<D<string>>(); // ok, circularity in assignment compat check causes success
>c1 : Symbol(c1, Decl(recursiveTypeInGenericConstraint.ts, 12, 3))
>Foo : Symbol(Foo, Decl(recursiveTypeInGenericConstraint.ts, 2, 1))
>D : Symbol(D, Decl(recursiveTypeInGenericConstraint.ts, 6, 1))