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 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
|
=== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers3.ts ===
interface Base {
>Base : Symbol(Base, Decl(subtypingWithObjectMembers3.ts, 0, 0))
foo: string;
>foo : Symbol(Base.foo, Decl(subtypingWithObjectMembers3.ts, 0, 16))
}
interface Derived extends Base {
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembers3.ts, 2, 1))
>Base : Symbol(Base, Decl(subtypingWithObjectMembers3.ts, 0, 0))
bar: string;
>bar : Symbol(Derived.bar, Decl(subtypingWithObjectMembers3.ts, 4, 32))
}
// N and M have the same name, same accessibility, same optionality, and N is a subtype of M
// foo properties are valid, bar properties cause errors in the derived class declarations
module NotOptional {
>NotOptional : Symbol(NotOptional, Decl(subtypingWithObjectMembers3.ts, 6, 1))
interface A {
>A : Symbol(A, Decl(subtypingWithObjectMembers3.ts, 10, 20))
foo: Base;
>foo : Symbol(A.foo, Decl(subtypingWithObjectMembers3.ts, 11, 17))
>Base : Symbol(Base, Decl(subtypingWithObjectMembers3.ts, 0, 0))
bar: Derived;
>bar : Symbol(A.bar, Decl(subtypingWithObjectMembers3.ts, 12, 18))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembers3.ts, 2, 1))
}
interface B extends A {
>B : Symbol(B, Decl(subtypingWithObjectMembers3.ts, 14, 5))
>A : Symbol(A, Decl(subtypingWithObjectMembers3.ts, 10, 20))
foo: Derived; // ok
>foo : Symbol(B.foo, Decl(subtypingWithObjectMembers3.ts, 16, 27))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembers3.ts, 2, 1))
bar: Base; // error
>bar : Symbol(B.bar, Decl(subtypingWithObjectMembers3.ts, 17, 21))
>Base : Symbol(Base, Decl(subtypingWithObjectMembers3.ts, 0, 0))
}
interface A2 {
>A2 : Symbol(A2, Decl(subtypingWithObjectMembers3.ts, 19, 5))
1: Base;
>1 : Symbol(A2[1], Decl(subtypingWithObjectMembers3.ts, 21, 18))
>Base : Symbol(Base, Decl(subtypingWithObjectMembers3.ts, 0, 0))
2.0: Derived;
>2.0 : Symbol(A2[2.0], Decl(subtypingWithObjectMembers3.ts, 22, 16))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembers3.ts, 2, 1))
}
interface B2 extends A2 {
>B2 : Symbol(B2, Decl(subtypingWithObjectMembers3.ts, 24, 5))
>A2 : Symbol(A2, Decl(subtypingWithObjectMembers3.ts, 19, 5))
1: Derived; // ok
>1 : Symbol(B2[1], Decl(subtypingWithObjectMembers3.ts, 26, 29))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembers3.ts, 2, 1))
2: Base; // error
>2 : Symbol(B2[2], Decl(subtypingWithObjectMembers3.ts, 27, 19))
>Base : Symbol(Base, Decl(subtypingWithObjectMembers3.ts, 0, 0))
}
interface A3 {
>A3 : Symbol(A3, Decl(subtypingWithObjectMembers3.ts, 29, 5))
'1': Base;
>'1' : Symbol(A3['1'], Decl(subtypingWithObjectMembers3.ts, 31, 18))
>Base : Symbol(Base, Decl(subtypingWithObjectMembers3.ts, 0, 0))
'2.0': Derived;
>'2.0' : Symbol(A3['2.0'], Decl(subtypingWithObjectMembers3.ts, 32, 18))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembers3.ts, 2, 1))
}
interface B3 extends A3 {
>B3 : Symbol(B3, Decl(subtypingWithObjectMembers3.ts, 34, 5))
>A3 : Symbol(A3, Decl(subtypingWithObjectMembers3.ts, 29, 5))
'1': Derived; // ok
>'1' : Symbol(B3['1'], Decl(subtypingWithObjectMembers3.ts, 36, 29))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembers3.ts, 2, 1))
'2.0': Base; // error
>'2.0' : Symbol(B3['2.0'], Decl(subtypingWithObjectMembers3.ts, 37, 21))
>Base : Symbol(Base, Decl(subtypingWithObjectMembers3.ts, 0, 0))
}
}
module Optional {
>Optional : Symbol(Optional, Decl(subtypingWithObjectMembers3.ts, 40, 1))
interface A {
>A : Symbol(A, Decl(subtypingWithObjectMembers3.ts, 42, 17))
foo?: Base;
>foo : Symbol(A.foo, Decl(subtypingWithObjectMembers3.ts, 43, 17))
>Base : Symbol(Base, Decl(subtypingWithObjectMembers3.ts, 0, 0))
bar?: Derived;
>bar : Symbol(A.bar, Decl(subtypingWithObjectMembers3.ts, 44, 19))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembers3.ts, 2, 1))
}
interface B extends A {
>B : Symbol(B, Decl(subtypingWithObjectMembers3.ts, 46, 5))
>A : Symbol(A, Decl(subtypingWithObjectMembers3.ts, 42, 17))
foo?: Derived; // ok
>foo : Symbol(B.foo, Decl(subtypingWithObjectMembers3.ts, 48, 27))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembers3.ts, 2, 1))
bar?: Base; // error
>bar : Symbol(B.bar, Decl(subtypingWithObjectMembers3.ts, 49, 22))
>Base : Symbol(Base, Decl(subtypingWithObjectMembers3.ts, 0, 0))
}
interface A2 {
>A2 : Symbol(A2, Decl(subtypingWithObjectMembers3.ts, 51, 5))
1?: Base;
>1 : Symbol(A2[1], Decl(subtypingWithObjectMembers3.ts, 53, 18))
>Base : Symbol(Base, Decl(subtypingWithObjectMembers3.ts, 0, 0))
2.0?: Derived;
>2.0 : Symbol(A2[2.0], Decl(subtypingWithObjectMembers3.ts, 54, 17))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembers3.ts, 2, 1))
}
interface B2 extends A2 {
>B2 : Symbol(B2, Decl(subtypingWithObjectMembers3.ts, 56, 5))
>A2 : Symbol(A2, Decl(subtypingWithObjectMembers3.ts, 51, 5))
1?: Derived; // ok
>1 : Symbol(B2[1], Decl(subtypingWithObjectMembers3.ts, 58, 29))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembers3.ts, 2, 1))
2?: Base; // error
>2 : Symbol(B2[2], Decl(subtypingWithObjectMembers3.ts, 59, 20))
>Base : Symbol(Base, Decl(subtypingWithObjectMembers3.ts, 0, 0))
}
interface A3 {
>A3 : Symbol(A3, Decl(subtypingWithObjectMembers3.ts, 61, 5))
'1'?: Base;
>'1' : Symbol(A3['1'], Decl(subtypingWithObjectMembers3.ts, 63, 18))
>Base : Symbol(Base, Decl(subtypingWithObjectMembers3.ts, 0, 0))
'2.0'?: Derived;
>'2.0' : Symbol(A3['2.0'], Decl(subtypingWithObjectMembers3.ts, 64, 19))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembers3.ts, 2, 1))
}
interface B3 extends A3 {
>B3 : Symbol(B3, Decl(subtypingWithObjectMembers3.ts, 66, 5))
>A3 : Symbol(A3, Decl(subtypingWithObjectMembers3.ts, 61, 5))
'1'?: Derived; // ok
>'1' : Symbol(B3['1'], Decl(subtypingWithObjectMembers3.ts, 68, 29))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembers3.ts, 2, 1))
'2.0'?: Base; // error
>'2.0' : Symbol(B3['2.0'], Decl(subtypingWithObjectMembers3.ts, 69, 22))
>Base : Symbol(Base, Decl(subtypingWithObjectMembers3.ts, 0, 0))
}
}
|