mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
new tests
This commit is contained in:
parent
0daa9eb0d4
commit
a8d205a2fc
@ -0,0 +1,10 @@
|
||||
abstract class foo {
|
||||
protected abstract test();
|
||||
}
|
||||
|
||||
class bar extends foo {
|
||||
test() {
|
||||
this.
|
||||
}
|
||||
}
|
||||
var x = new bar();
|
||||
@ -0,0 +1,9 @@
|
||||
module M {
|
||||
export abstract class A {}
|
||||
|
||||
new A;
|
||||
}
|
||||
|
||||
import myA = M.A;
|
||||
|
||||
new myA;
|
||||
@ -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;
|
||||
@ -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;
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
export default abstract class A {}
|
||||
export abstract class B {}
|
||||
default abstract class C {}
|
||||
import abstract class D {}
|
||||
@ -0,0 +1,12 @@
|
||||
abstract class A {}
|
||||
|
||||
abstract
|
||||
class B {}
|
||||
|
||||
abstract
|
||||
|
||||
class C {}
|
||||
|
||||
new A;
|
||||
new B;
|
||||
new C;
|
||||
Loading…
x
Reference in New Issue
Block a user