File: implementGenericWithMismatchedTypes.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 (53 lines) | stat: -rw-r--r-- 2,454 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
=== tests/cases/compiler/implementGenericWithMismatchedTypes.ts ===
// no errors because in the derived types the best common type for T's value is Object
// and that matches the original signature for assignability since we treat its T's as Object

interface IFoo<T> {
>IFoo : Symbol(IFoo, Decl(implementGenericWithMismatchedTypes.ts, 0, 0))
>T : Symbol(T, Decl(implementGenericWithMismatchedTypes.ts, 3, 15))

    foo(x: T): T;
>foo : Symbol(IFoo.foo, Decl(implementGenericWithMismatchedTypes.ts, 3, 19))
>x : Symbol(x, Decl(implementGenericWithMismatchedTypes.ts, 4, 8))
>T : Symbol(T, Decl(implementGenericWithMismatchedTypes.ts, 3, 15))
>T : Symbol(T, Decl(implementGenericWithMismatchedTypes.ts, 3, 15))
}
class C<T> implements IFoo<T> { // error
>C : Symbol(C, Decl(implementGenericWithMismatchedTypes.ts, 5, 1))
>T : Symbol(T, Decl(implementGenericWithMismatchedTypes.ts, 6, 8))
>IFoo : Symbol(IFoo, Decl(implementGenericWithMismatchedTypes.ts, 0, 0))
>T : Symbol(T, Decl(implementGenericWithMismatchedTypes.ts, 6, 8))

    foo(x: string): number {
>foo : Symbol(C.foo, Decl(implementGenericWithMismatchedTypes.ts, 6, 31))
>x : Symbol(x, Decl(implementGenericWithMismatchedTypes.ts, 7, 8))

        return null;
    }
}

interface IFoo2<T> {
>IFoo2 : Symbol(IFoo2, Decl(implementGenericWithMismatchedTypes.ts, 10, 1))
>T : Symbol(T, Decl(implementGenericWithMismatchedTypes.ts, 12, 16))

    foo(x: T): T;
>foo : Symbol(IFoo2.foo, Decl(implementGenericWithMismatchedTypes.ts, 12, 20))
>x : Symbol(x, Decl(implementGenericWithMismatchedTypes.ts, 13, 8))
>T : Symbol(T, Decl(implementGenericWithMismatchedTypes.ts, 12, 16))
>T : Symbol(T, Decl(implementGenericWithMismatchedTypes.ts, 12, 16))
}
class C2<T> implements IFoo2<T> { // error
>C2 : Symbol(C2, Decl(implementGenericWithMismatchedTypes.ts, 14, 1))
>T : Symbol(T, Decl(implementGenericWithMismatchedTypes.ts, 15, 9))
>IFoo2 : Symbol(IFoo2, Decl(implementGenericWithMismatchedTypes.ts, 10, 1))
>T : Symbol(T, Decl(implementGenericWithMismatchedTypes.ts, 15, 9))

    foo<Tstring>(x: Tstring): number {
>foo : Symbol(C2.foo, Decl(implementGenericWithMismatchedTypes.ts, 15, 33))
>Tstring : Symbol(Tstring, Decl(implementGenericWithMismatchedTypes.ts, 16, 8))
>x : Symbol(x, Decl(implementGenericWithMismatchedTypes.ts, 16, 17))
>Tstring : Symbol(Tstring, Decl(implementGenericWithMismatchedTypes.ts, 16, 8))

        return null;
    }
}