02fc8b1b2d
1. Positive tests. 2. Negative tests. 3. Update error messages. 4. Remove errors from conformance test.
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
//@target: ES5
|
|
interface A {
|
|
prop: string;
|
|
m(): string;
|
|
}
|
|
abstract class B implements A {
|
|
abstract prop: string;
|
|
public abstract readonly ro: string;
|
|
abstract get readonlyProp(): string;
|
|
abstract m(): string;
|
|
abstract get mismatch(): string;
|
|
abstract set mismatch(val: number); // error, not same type
|
|
}
|
|
class C extends B {
|
|
readonly ro = "readonly please";
|
|
abstract notAllowed: string;
|
|
get concreteWithNoBody(): string;
|
|
}
|
|
let c = new C();
|
|
c.ro = "error: lhs of assignment can't be readonly";
|
|
|
|
abstract class WrongTypeProperty {
|
|
abstract num: number;
|
|
}
|
|
class WrongTypePropertyImpl extends WrongTypeProperty {
|
|
num = "nope, wrong";
|
|
}
|
|
abstract class WrongTypeAccessor {
|
|
abstract get num(): number;
|
|
}
|
|
class WrongTypeAccessorImpl extends WrongTypeAccessor {
|
|
get num() { return "nope, wrong"; }
|
|
}
|
|
class WrongTypeAccessorImpl2 extends WrongTypeAccessor {
|
|
num = "nope, wrong";
|
|
}
|
|
|
|
abstract class AbstractAccessorMismatch {
|
|
abstract get p1(): string;
|
|
set p1(val: string) { };
|
|
get p2(): string { return "should work"; }
|
|
abstract set p2(val: string);
|
|
}
|