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