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
|
=== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithObjectMembers5.ts ===
interface Base {
>Base : Symbol(Base, Decl(subtypingWithObjectMembers5.ts, 0, 0))
foo: string;
>foo : Symbol(Base.foo, Decl(subtypingWithObjectMembers5.ts, 0, 16))
}
interface Derived extends Base {
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembers5.ts, 2, 1))
>Base : Symbol(Base, Decl(subtypingWithObjectMembers5.ts, 0, 0))
bar: string;
>bar : Symbol(Derived.bar, Decl(subtypingWithObjectMembers5.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(subtypingWithObjectMembers5.ts, 6, 1))
interface A {
>A : Symbol(A, Decl(subtypingWithObjectMembers5.ts, 10, 20))
foo: Base;
>foo : Symbol(A.foo, Decl(subtypingWithObjectMembers5.ts, 11, 17))
>Base : Symbol(Base, Decl(subtypingWithObjectMembers5.ts, 0, 0))
}
class B implements A {
>B : Symbol(B, Decl(subtypingWithObjectMembers5.ts, 13, 5))
>A : Symbol(A, Decl(subtypingWithObjectMembers5.ts, 10, 20))
fooo: Derived; // error
>fooo : Symbol(B.fooo, Decl(subtypingWithObjectMembers5.ts, 15, 26))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembers5.ts, 2, 1))
}
interface A2 {
>A2 : Symbol(A2, Decl(subtypingWithObjectMembers5.ts, 17, 5))
1: Base;
>1 : Symbol(A2[1], Decl(subtypingWithObjectMembers5.ts, 19, 18))
>Base : Symbol(Base, Decl(subtypingWithObjectMembers5.ts, 0, 0))
}
class B2 implements A2 {
>B2 : Symbol(B2, Decl(subtypingWithObjectMembers5.ts, 21, 5))
>A2 : Symbol(A2, Decl(subtypingWithObjectMembers5.ts, 17, 5))
2: Derived; // error
>2 : Symbol(B2[2], Decl(subtypingWithObjectMembers5.ts, 23, 28))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembers5.ts, 2, 1))
}
interface A3 {
>A3 : Symbol(A3, Decl(subtypingWithObjectMembers5.ts, 25, 5))
'1': Base;
>'1' : Symbol(A3['1'], Decl(subtypingWithObjectMembers5.ts, 27, 18))
>Base : Symbol(Base, Decl(subtypingWithObjectMembers5.ts, 0, 0))
}
class B3 implements A3 {
>B3 : Symbol(B3, Decl(subtypingWithObjectMembers5.ts, 29, 5))
>A3 : Symbol(A3, Decl(subtypingWithObjectMembers5.ts, 25, 5))
'1.0': Derived; // error
>'1.0' : Symbol(B3['1.0'], Decl(subtypingWithObjectMembers5.ts, 31, 28))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembers5.ts, 2, 1))
}
}
// same cases as above but with optional
module Optional {
>Optional : Symbol(Optional, Decl(subtypingWithObjectMembers5.ts, 34, 1))
interface A {
>A : Symbol(A, Decl(subtypingWithObjectMembers5.ts, 37, 17))
foo?: Base;
>foo : Symbol(A.foo, Decl(subtypingWithObjectMembers5.ts, 38, 17))
>Base : Symbol(Base, Decl(subtypingWithObjectMembers5.ts, 0, 0))
}
class B implements A {
>B : Symbol(B, Decl(subtypingWithObjectMembers5.ts, 40, 5))
>A : Symbol(A, Decl(subtypingWithObjectMembers5.ts, 37, 17))
fooo: Derived; // weak type error
>fooo : Symbol(B.fooo, Decl(subtypingWithObjectMembers5.ts, 42, 26))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembers5.ts, 2, 1))
}
interface A2 {
>A2 : Symbol(A2, Decl(subtypingWithObjectMembers5.ts, 44, 5))
1?: Base;
>1 : Symbol(A2[1], Decl(subtypingWithObjectMembers5.ts, 46, 18))
>Base : Symbol(Base, Decl(subtypingWithObjectMembers5.ts, 0, 0))
}
class B2 implements A2 {
>B2 : Symbol(B2, Decl(subtypingWithObjectMembers5.ts, 48, 5))
>A2 : Symbol(A2, Decl(subtypingWithObjectMembers5.ts, 44, 5))
2: Derived; // weak type error
>2 : Symbol(B2[2], Decl(subtypingWithObjectMembers5.ts, 50, 28))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembers5.ts, 2, 1))
}
interface A3 {
>A3 : Symbol(A3, Decl(subtypingWithObjectMembers5.ts, 52, 5))
'1'?: Base;
>'1' : Symbol(A3['1'], Decl(subtypingWithObjectMembers5.ts, 54, 18))
>Base : Symbol(Base, Decl(subtypingWithObjectMembers5.ts, 0, 0))
}
class B3 implements A3 {
>B3 : Symbol(B3, Decl(subtypingWithObjectMembers5.ts, 56, 5))
>A3 : Symbol(A3, Decl(subtypingWithObjectMembers5.ts, 52, 5))
'1.0': Derived; // weak type error
>'1.0' : Symbol(B3['1.0'], Decl(subtypingWithObjectMembers5.ts, 58, 28))
>Derived : Symbol(Derived, Decl(subtypingWithObjectMembers5.ts, 2, 1))
}
}
|