new tests

This commit is contained in:
Arthur Ozga 2015-06-22 16:06:17 -07:00
parent 0daa9eb0d4
commit a8d205a2fc
6 changed files with 86 additions and 8 deletions

View File

@ -0,0 +1,10 @@
abstract class foo {
protected abstract test();
}
class bar extends foo {
test() {
this.
}
}
var x = new bar();

View File

@ -0,0 +1,9 @@
module M {
export abstract class A {}
new A;
}
import myA = M.A;
new myA;

View File

@ -16,11 +16,3 @@ var c : C;
a = new B;
b = new B;
c = new B;
module M {
export abstract class A {}
}
import myA = M.A;
var aa = new myA;

View File

@ -0,0 +1,51 @@
class A {
// ...
}
abstract class B {
foo(): number { return bar(); }
abstract bar() : number;
}
new B; // error
var BB: typeof B = B;
var AA: typeof A = BB; // error, AA is not of abstract type.
new AA;
function constructB(Factory : typeof B) {
new Factory; // error -- Factory is of type typeof C
}
var BB = B;
new BB; // error -- BB is of type typeof C
var x : any = C;
new x; // okay -- undefined behavior at runtime
class C extends B { } // error -- not declared abstract
abstract class D extends B { } // okay
class E extends B { // okay -- implements abstract method
bar() { return 1; }
}
abstract class F extends B {
abstract foo() : number;
bar() { return 2; }
}
abstract class G {
abstract qux(x : number) : string;
abstract qux() : number;
y : number;
abstract quz(x : number, y : string) : boolean; // error -- declarations must be adjacent
abstract nom() boolean;
nom(x : number) boolean; // error -- use of modifier abstract must match on all overloads.
}
class H { // error -- not declared abstract
abstract baz() : number;
}

View File

@ -0,0 +1,4 @@
export default abstract class A {}
export abstract class B {}
default abstract class C {}
import abstract class D {}

View File

@ -0,0 +1,12 @@
abstract class A {}
abstract
class B {}
abstract
class C {}
new A;
new B;
new C;