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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
=== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithNumericIndexer3.ts ===
// Derived type indexer must be subtype of base type indexer
interface Base { foo: string; }
>Base : Symbol(Base, Decl(subtypingWithNumericIndexer3.ts, 0, 0))
>foo : Symbol(Base.foo, Decl(subtypingWithNumericIndexer3.ts, 2, 16))
interface Derived extends Base { bar: string; }
>Derived : Symbol(Derived, Decl(subtypingWithNumericIndexer3.ts, 2, 31))
>Base : Symbol(Base, Decl(subtypingWithNumericIndexer3.ts, 0, 0))
>bar : Symbol(Derived.bar, Decl(subtypingWithNumericIndexer3.ts, 3, 32))
interface Derived2 extends Derived { baz: string; }
>Derived2 : Symbol(Derived2, Decl(subtypingWithNumericIndexer3.ts, 3, 47))
>Derived : Symbol(Derived, Decl(subtypingWithNumericIndexer3.ts, 2, 31))
>baz : Symbol(Derived2.baz, Decl(subtypingWithNumericIndexer3.ts, 4, 36))
class A {
>A : Symbol(A, Decl(subtypingWithNumericIndexer3.ts, 4, 51))
[x: number]: Derived;
>x : Symbol(x, Decl(subtypingWithNumericIndexer3.ts, 7, 5))
>Derived : Symbol(Derived, Decl(subtypingWithNumericIndexer3.ts, 2, 31))
}
class B extends A {
>B : Symbol(B, Decl(subtypingWithNumericIndexer3.ts, 8, 1))
>A : Symbol(A, Decl(subtypingWithNumericIndexer3.ts, 4, 51))
[x: number]: Base; // error
>x : Symbol(x, Decl(subtypingWithNumericIndexer3.ts, 11, 5))
>Base : Symbol(Base, Decl(subtypingWithNumericIndexer3.ts, 0, 0))
}
class B2 extends A {
>B2 : Symbol(B2, Decl(subtypingWithNumericIndexer3.ts, 12, 1))
>A : Symbol(A, Decl(subtypingWithNumericIndexer3.ts, 4, 51))
[x: number]: Derived2; // ok
>x : Symbol(x, Decl(subtypingWithNumericIndexer3.ts, 15, 5))
>Derived2 : Symbol(Derived2, Decl(subtypingWithNumericIndexer3.ts, 3, 47))
}
module Generics {
>Generics : Symbol(Generics, Decl(subtypingWithNumericIndexer3.ts, 16, 1))
class A<T extends Derived> {
>A : Symbol(A, Decl(subtypingWithNumericIndexer3.ts, 18, 17))
>T : Symbol(T, Decl(subtypingWithNumericIndexer3.ts, 19, 12))
>Derived : Symbol(Derived, Decl(subtypingWithNumericIndexer3.ts, 2, 31))
[x: number]: T;
>x : Symbol(x, Decl(subtypingWithNumericIndexer3.ts, 20, 9))
>T : Symbol(T, Decl(subtypingWithNumericIndexer3.ts, 19, 12))
}
class B extends A<Base> {
>B : Symbol(B, Decl(subtypingWithNumericIndexer3.ts, 21, 5))
>A : Symbol(A, Decl(subtypingWithNumericIndexer3.ts, 18, 17))
>Base : Symbol(Base, Decl(subtypingWithNumericIndexer3.ts, 0, 0))
[x: number]: Derived; // error
>x : Symbol(x, Decl(subtypingWithNumericIndexer3.ts, 24, 9))
>Derived : Symbol(Derived, Decl(subtypingWithNumericIndexer3.ts, 2, 31))
}
class B2 extends A<Derived> {
>B2 : Symbol(B2, Decl(subtypingWithNumericIndexer3.ts, 25, 5))
>A : Symbol(A, Decl(subtypingWithNumericIndexer3.ts, 18, 17))
>Derived : Symbol(Derived, Decl(subtypingWithNumericIndexer3.ts, 2, 31))
[x: number]: Derived2; // ok
>x : Symbol(x, Decl(subtypingWithNumericIndexer3.ts, 28, 9))
>Derived2 : Symbol(Derived2, Decl(subtypingWithNumericIndexer3.ts, 3, 47))
}
class B3<T extends Derived> extends A<T> {
>B3 : Symbol(B3, Decl(subtypingWithNumericIndexer3.ts, 29, 5))
>T : Symbol(T, Decl(subtypingWithNumericIndexer3.ts, 31, 13))
>Derived : Symbol(Derived, Decl(subtypingWithNumericIndexer3.ts, 2, 31))
>A : Symbol(A, Decl(subtypingWithNumericIndexer3.ts, 18, 17))
>T : Symbol(T, Decl(subtypingWithNumericIndexer3.ts, 31, 13))
[x: number]: Base; // error
>x : Symbol(x, Decl(subtypingWithNumericIndexer3.ts, 32, 9))
>Base : Symbol(Base, Decl(subtypingWithNumericIndexer3.ts, 0, 0))
}
class B4<T extends Derived> extends A<T> {
>B4 : Symbol(B4, Decl(subtypingWithNumericIndexer3.ts, 33, 5))
>T : Symbol(T, Decl(subtypingWithNumericIndexer3.ts, 35, 13))
>Derived : Symbol(Derived, Decl(subtypingWithNumericIndexer3.ts, 2, 31))
>A : Symbol(A, Decl(subtypingWithNumericIndexer3.ts, 18, 17))
>T : Symbol(T, Decl(subtypingWithNumericIndexer3.ts, 35, 13))
[x: number]: Derived; // error
>x : Symbol(x, Decl(subtypingWithNumericIndexer3.ts, 36, 9))
>Derived : Symbol(Derived, Decl(subtypingWithNumericIndexer3.ts, 2, 31))
}
class B5<T extends Derived2> extends A<T> {
>B5 : Symbol(B5, Decl(subtypingWithNumericIndexer3.ts, 37, 5))
>T : Symbol(T, Decl(subtypingWithNumericIndexer3.ts, 39, 13))
>Derived2 : Symbol(Derived2, Decl(subtypingWithNumericIndexer3.ts, 3, 47))
>A : Symbol(A, Decl(subtypingWithNumericIndexer3.ts, 18, 17))
>T : Symbol(T, Decl(subtypingWithNumericIndexer3.ts, 39, 13))
[x: number]: Derived2; // error
>x : Symbol(x, Decl(subtypingWithNumericIndexer3.ts, 40, 9))
>Derived2 : Symbol(Derived2, Decl(subtypingWithNumericIndexer3.ts, 3, 47))
}
}
|