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
|
=== tests/cases/compiler/abstractPropertyNegative.ts ===
interface A {
>A : Symbol(A, Decl(abstractPropertyNegative.ts, 0, 0))
prop: string;
>prop : Symbol(A.prop, Decl(abstractPropertyNegative.ts, 0, 13))
m(): string;
>m : Symbol(A.m, Decl(abstractPropertyNegative.ts, 1, 17))
}
abstract class B implements A {
>B : Symbol(B, Decl(abstractPropertyNegative.ts, 3, 1))
>A : Symbol(A, Decl(abstractPropertyNegative.ts, 0, 0))
abstract prop: string;
>prop : Symbol(B.prop, Decl(abstractPropertyNegative.ts, 4, 31))
public abstract readonly ro: string;
>ro : Symbol(B.ro, Decl(abstractPropertyNegative.ts, 5, 26))
abstract get readonlyProp(): string;
>readonlyProp : Symbol(B.readonlyProp, Decl(abstractPropertyNegative.ts, 6, 40))
abstract m(): string;
>m : Symbol(B.m, Decl(abstractPropertyNegative.ts, 7, 40))
abstract get mismatch(): string;
>mismatch : Symbol(B.mismatch, Decl(abstractPropertyNegative.ts, 8, 25), Decl(abstractPropertyNegative.ts, 9, 36))
abstract set mismatch(val: number); // error, not same type
>mismatch : Symbol(B.mismatch, Decl(abstractPropertyNegative.ts, 8, 25), Decl(abstractPropertyNegative.ts, 9, 36))
>val : Symbol(val, Decl(abstractPropertyNegative.ts, 10, 26))
}
class C extends B {
>C : Symbol(C, Decl(abstractPropertyNegative.ts, 11, 1))
>B : Symbol(B, Decl(abstractPropertyNegative.ts, 3, 1))
readonly ro = "readonly please";
>ro : Symbol(C.ro, Decl(abstractPropertyNegative.ts, 12, 19))
abstract notAllowed: string;
>notAllowed : Symbol(C.notAllowed, Decl(abstractPropertyNegative.ts, 13, 36))
get concreteWithNoBody(): string;
>concreteWithNoBody : Symbol(C.concreteWithNoBody, Decl(abstractPropertyNegative.ts, 14, 32))
}
let c = new C();
>c : Symbol(c, Decl(abstractPropertyNegative.ts, 17, 3))
>C : Symbol(C, Decl(abstractPropertyNegative.ts, 11, 1))
c.ro = "error: lhs of assignment can't be readonly";
>c.ro : Symbol(C.ro, Decl(abstractPropertyNegative.ts, 12, 19))
>c : Symbol(c, Decl(abstractPropertyNegative.ts, 17, 3))
>ro : Symbol(C.ro, Decl(abstractPropertyNegative.ts, 12, 19))
abstract class WrongTypeProperty {
>WrongTypeProperty : Symbol(WrongTypeProperty, Decl(abstractPropertyNegative.ts, 18, 52))
abstract num: number;
>num : Symbol(WrongTypeProperty.num, Decl(abstractPropertyNegative.ts, 20, 34))
}
class WrongTypePropertyImpl extends WrongTypeProperty {
>WrongTypePropertyImpl : Symbol(WrongTypePropertyImpl, Decl(abstractPropertyNegative.ts, 22, 1))
>WrongTypeProperty : Symbol(WrongTypeProperty, Decl(abstractPropertyNegative.ts, 18, 52))
num = "nope, wrong";
>num : Symbol(WrongTypePropertyImpl.num, Decl(abstractPropertyNegative.ts, 23, 55))
}
abstract class WrongTypeAccessor {
>WrongTypeAccessor : Symbol(WrongTypeAccessor, Decl(abstractPropertyNegative.ts, 25, 1))
abstract get num(): number;
>num : Symbol(WrongTypeAccessor.num, Decl(abstractPropertyNegative.ts, 26, 34))
}
class WrongTypeAccessorImpl extends WrongTypeAccessor {
>WrongTypeAccessorImpl : Symbol(WrongTypeAccessorImpl, Decl(abstractPropertyNegative.ts, 28, 1))
>WrongTypeAccessor : Symbol(WrongTypeAccessor, Decl(abstractPropertyNegative.ts, 25, 1))
get num() { return "nope, wrong"; }
>num : Symbol(WrongTypeAccessorImpl.num, Decl(abstractPropertyNegative.ts, 29, 55))
}
class WrongTypeAccessorImpl2 extends WrongTypeAccessor {
>WrongTypeAccessorImpl2 : Symbol(WrongTypeAccessorImpl2, Decl(abstractPropertyNegative.ts, 31, 1))
>WrongTypeAccessor : Symbol(WrongTypeAccessor, Decl(abstractPropertyNegative.ts, 25, 1))
num = "nope, wrong";
>num : Symbol(WrongTypeAccessorImpl2.num, Decl(abstractPropertyNegative.ts, 32, 56))
}
abstract class AbstractAccessorMismatch {
>AbstractAccessorMismatch : Symbol(AbstractAccessorMismatch, Decl(abstractPropertyNegative.ts, 34, 1))
abstract get p1(): string;
>p1 : Symbol(AbstractAccessorMismatch.p1, Decl(abstractPropertyNegative.ts, 36, 41), Decl(abstractPropertyNegative.ts, 37, 30))
set p1(val: string) { };
>p1 : Symbol(AbstractAccessorMismatch.p1, Decl(abstractPropertyNegative.ts, 36, 41), Decl(abstractPropertyNegative.ts, 37, 30))
>val : Symbol(val, Decl(abstractPropertyNegative.ts, 38, 11))
get p2(): string { return "should work"; }
>p2 : Symbol(AbstractAccessorMismatch.p2, Decl(abstractPropertyNegative.ts, 38, 28), Decl(abstractPropertyNegative.ts, 39, 46))
abstract set p2(val: string);
>p2 : Symbol(AbstractAccessorMismatch.p2, Decl(abstractPropertyNegative.ts, 38, 28), Decl(abstractPropertyNegative.ts, 39, 46))
>val : Symbol(val, Decl(abstractPropertyNegative.ts, 40, 20))
}
|