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 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithStringIndexer2.ts ===
// index signatures must be compatible in assignments
interface Base { foo: string; }
>Base : Symbol(Base, Decl(assignmentCompatWithStringIndexer2.ts, 0, 0))
>foo : Symbol(Base.foo, Decl(assignmentCompatWithStringIndexer2.ts, 2, 16))
interface Derived extends Base { bar: string; }
>Derived : Symbol(Derived, Decl(assignmentCompatWithStringIndexer2.ts, 2, 31))
>Base : Symbol(Base, Decl(assignmentCompatWithStringIndexer2.ts, 0, 0))
>bar : Symbol(Derived.bar, Decl(assignmentCompatWithStringIndexer2.ts, 3, 32))
interface Derived2 extends Derived { baz: string; }
>Derived2 : Symbol(Derived2, Decl(assignmentCompatWithStringIndexer2.ts, 3, 47))
>Derived : Symbol(Derived, Decl(assignmentCompatWithStringIndexer2.ts, 2, 31))
>baz : Symbol(Derived2.baz, Decl(assignmentCompatWithStringIndexer2.ts, 4, 36))
interface A {
>A : Symbol(A, Decl(assignmentCompatWithStringIndexer2.ts, 4, 51))
[x: string]: Base;
>x : Symbol(x, Decl(assignmentCompatWithStringIndexer2.ts, 7, 5))
>Base : Symbol(Base, Decl(assignmentCompatWithStringIndexer2.ts, 0, 0))
}
var a: A;
>a : Symbol(a, Decl(assignmentCompatWithStringIndexer2.ts, 10, 3))
>A : Symbol(A, Decl(assignmentCompatWithStringIndexer2.ts, 4, 51))
var b: { [x: string]: Derived; }
>b : Symbol(b, Decl(assignmentCompatWithStringIndexer2.ts, 12, 3))
>x : Symbol(x, Decl(assignmentCompatWithStringIndexer2.ts, 12, 10))
>Derived : Symbol(Derived, Decl(assignmentCompatWithStringIndexer2.ts, 2, 31))
a = b; // ok
>a : Symbol(a, Decl(assignmentCompatWithStringIndexer2.ts, 10, 3))
>b : Symbol(b, Decl(assignmentCompatWithStringIndexer2.ts, 12, 3))
b = a; // error
>b : Symbol(b, Decl(assignmentCompatWithStringIndexer2.ts, 12, 3))
>a : Symbol(a, Decl(assignmentCompatWithStringIndexer2.ts, 10, 3))
var b2: { [x: string]: Derived2; }
>b2 : Symbol(b2, Decl(assignmentCompatWithStringIndexer2.ts, 16, 3))
>x : Symbol(x, Decl(assignmentCompatWithStringIndexer2.ts, 16, 11))
>Derived2 : Symbol(Derived2, Decl(assignmentCompatWithStringIndexer2.ts, 3, 47))
a = b2; // ok
>a : Symbol(a, Decl(assignmentCompatWithStringIndexer2.ts, 10, 3))
>b2 : Symbol(b2, Decl(assignmentCompatWithStringIndexer2.ts, 16, 3))
b2 = a; // error
>b2 : Symbol(b2, Decl(assignmentCompatWithStringIndexer2.ts, 16, 3))
>a : Symbol(a, Decl(assignmentCompatWithStringIndexer2.ts, 10, 3))
module Generics {
>Generics : Symbol(Generics, Decl(assignmentCompatWithStringIndexer2.ts, 18, 7))
interface A<T extends Base> {
>A : Symbol(A, Decl(assignmentCompatWithStringIndexer2.ts, 20, 17))
>T : Symbol(T, Decl(assignmentCompatWithStringIndexer2.ts, 21, 16))
>Base : Symbol(Base, Decl(assignmentCompatWithStringIndexer2.ts, 0, 0))
[x: string]: T;
>x : Symbol(x, Decl(assignmentCompatWithStringIndexer2.ts, 22, 9))
>T : Symbol(T, Decl(assignmentCompatWithStringIndexer2.ts, 21, 16))
}
interface B extends A<Base> {
>B : Symbol(B, Decl(assignmentCompatWithStringIndexer2.ts, 23, 5))
>A : Symbol(A, Decl(assignmentCompatWithStringIndexer2.ts, 20, 17))
>Base : Symbol(Base, Decl(assignmentCompatWithStringIndexer2.ts, 0, 0))
[x: string]: Derived; // ok
>x : Symbol(x, Decl(assignmentCompatWithStringIndexer2.ts, 26, 9))
>Derived : Symbol(Derived, Decl(assignmentCompatWithStringIndexer2.ts, 2, 31))
}
var b1: { [x: string]: Derived; };
>b1 : Symbol(b1, Decl(assignmentCompatWithStringIndexer2.ts, 29, 7))
>x : Symbol(x, Decl(assignmentCompatWithStringIndexer2.ts, 29, 15))
>Derived : Symbol(Derived, Decl(assignmentCompatWithStringIndexer2.ts, 2, 31))
var a1: A<Base>;
>a1 : Symbol(a1, Decl(assignmentCompatWithStringIndexer2.ts, 30, 7))
>A : Symbol(A, Decl(assignmentCompatWithStringIndexer2.ts, 20, 17))
>Base : Symbol(Base, Decl(assignmentCompatWithStringIndexer2.ts, 0, 0))
a1 = b1; // ok
>a1 : Symbol(a1, Decl(assignmentCompatWithStringIndexer2.ts, 30, 7))
>b1 : Symbol(b1, Decl(assignmentCompatWithStringIndexer2.ts, 29, 7))
b1 = a1; // error
>b1 : Symbol(b1, Decl(assignmentCompatWithStringIndexer2.ts, 29, 7))
>a1 : Symbol(a1, Decl(assignmentCompatWithStringIndexer2.ts, 30, 7))
interface B2 extends A<Base> {
>B2 : Symbol(B2, Decl(assignmentCompatWithStringIndexer2.ts, 32, 12))
>A : Symbol(A, Decl(assignmentCompatWithStringIndexer2.ts, 20, 17))
>Base : Symbol(Base, Decl(assignmentCompatWithStringIndexer2.ts, 0, 0))
[x: string]: Derived2; // ok
>x : Symbol(x, Decl(assignmentCompatWithStringIndexer2.ts, 35, 9))
>Derived2 : Symbol(Derived2, Decl(assignmentCompatWithStringIndexer2.ts, 3, 47))
}
var b2: { [x: string]: Derived2; };
>b2 : Symbol(b2, Decl(assignmentCompatWithStringIndexer2.ts, 38, 7))
>x : Symbol(x, Decl(assignmentCompatWithStringIndexer2.ts, 38, 15))
>Derived2 : Symbol(Derived2, Decl(assignmentCompatWithStringIndexer2.ts, 3, 47))
a1 = b2; // ok
>a1 : Symbol(a1, Decl(assignmentCompatWithStringIndexer2.ts, 30, 7))
>b2 : Symbol(b2, Decl(assignmentCompatWithStringIndexer2.ts, 38, 7))
b2 = a1; // error
>b2 : Symbol(b2, Decl(assignmentCompatWithStringIndexer2.ts, 38, 7))
>a1 : Symbol(a1, Decl(assignmentCompatWithStringIndexer2.ts, 30, 7))
function foo<T extends Base>() {
>foo : Symbol(foo, Decl(assignmentCompatWithStringIndexer2.ts, 40, 12))
>T : Symbol(T, Decl(assignmentCompatWithStringIndexer2.ts, 42, 17))
>Base : Symbol(Base, Decl(assignmentCompatWithStringIndexer2.ts, 0, 0))
var b3: { [x: string]: Derived; };
>b3 : Symbol(b3, Decl(assignmentCompatWithStringIndexer2.ts, 43, 11))
>x : Symbol(x, Decl(assignmentCompatWithStringIndexer2.ts, 43, 19))
>Derived : Symbol(Derived, Decl(assignmentCompatWithStringIndexer2.ts, 2, 31))
var a3: A<T>;
>a3 : Symbol(a3, Decl(assignmentCompatWithStringIndexer2.ts, 44, 11))
>A : Symbol(A, Decl(assignmentCompatWithStringIndexer2.ts, 20, 17))
>T : Symbol(T, Decl(assignmentCompatWithStringIndexer2.ts, 42, 17))
a3 = b3; // error
>a3 : Symbol(a3, Decl(assignmentCompatWithStringIndexer2.ts, 44, 11))
>b3 : Symbol(b3, Decl(assignmentCompatWithStringIndexer2.ts, 43, 11))
b3 = a3; // error
>b3 : Symbol(b3, Decl(assignmentCompatWithStringIndexer2.ts, 43, 11))
>a3 : Symbol(a3, Decl(assignmentCompatWithStringIndexer2.ts, 44, 11))
var b4: { [x: string]: Derived2; };
>b4 : Symbol(b4, Decl(assignmentCompatWithStringIndexer2.ts, 48, 11))
>x : Symbol(x, Decl(assignmentCompatWithStringIndexer2.ts, 48, 19))
>Derived2 : Symbol(Derived2, Decl(assignmentCompatWithStringIndexer2.ts, 3, 47))
a3 = b4; // error
>a3 : Symbol(a3, Decl(assignmentCompatWithStringIndexer2.ts, 44, 11))
>b4 : Symbol(b4, Decl(assignmentCompatWithStringIndexer2.ts, 48, 11))
b4 = a3; // error
>b4 : Symbol(b4, Decl(assignmentCompatWithStringIndexer2.ts, 48, 11))
>a3 : Symbol(a3, Decl(assignmentCompatWithStringIndexer2.ts, 44, 11))
}
}
|