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
|
=== tests/cases/compiler/genericSpecializations2.ts ===
class IFoo<T> {
>IFoo : Symbol(IFoo, Decl(genericSpecializations2.ts, 0, 0))
>T : Symbol(T, Decl(genericSpecializations2.ts, 0, 11))
foo<T>(x: T): T { // no error on implementors because IFoo's T is different from foo's T
>foo : Symbol(IFoo.foo, Decl(genericSpecializations2.ts, 0, 15))
>T : Symbol(T, Decl(genericSpecializations2.ts, 1, 8))
>x : Symbol(x, Decl(genericSpecializations2.ts, 1, 11))
>T : Symbol(T, Decl(genericSpecializations2.ts, 1, 8))
>T : Symbol(T, Decl(genericSpecializations2.ts, 1, 8))
return null;
}
}
class IntFooBad implements IFoo<number> {
>IntFooBad : Symbol(IntFooBad, Decl(genericSpecializations2.ts, 4, 1))
>IFoo : Symbol(IFoo, Decl(genericSpecializations2.ts, 0, 0))
foo<string>(x: string): string { return null; }
>foo : Symbol(IntFooBad.foo, Decl(genericSpecializations2.ts, 6, 41))
>string : Symbol(string, Decl(genericSpecializations2.ts, 7, 8))
>x : Symbol(x, Decl(genericSpecializations2.ts, 7, 16))
}
class StringFoo2 implements IFoo<string> {
>StringFoo2 : Symbol(StringFoo2, Decl(genericSpecializations2.ts, 8, 1))
>IFoo : Symbol(IFoo, Decl(genericSpecializations2.ts, 0, 0))
foo<string>(x: string): string { return null; }
>foo : Symbol(StringFoo2.foo, Decl(genericSpecializations2.ts, 10, 42))
>string : Symbol(string, Decl(genericSpecializations2.ts, 11, 8))
>x : Symbol(x, Decl(genericSpecializations2.ts, 11, 16))
}
class StringFoo3 implements IFoo<string> {
>StringFoo3 : Symbol(StringFoo3, Decl(genericSpecializations2.ts, 12, 1))
>IFoo : Symbol(IFoo, Decl(genericSpecializations2.ts, 0, 0))
foo<T>(x: T): T { return null; }
>foo : Symbol(StringFoo3.foo, Decl(genericSpecializations2.ts, 14, 42))
>T : Symbol(T, Decl(genericSpecializations2.ts, 15, 8))
>x : Symbol(x, Decl(genericSpecializations2.ts, 15, 11))
>T : Symbol(T, Decl(genericSpecializations2.ts, 15, 8))
>T : Symbol(T, Decl(genericSpecializations2.ts, 15, 8))
}
|