TypeScript/tests/baselines/reference/classAbstractInstantiations2.errors.txt
2015-06-30 14:44:13 -07:00

75 lines
3.4 KiB
Plaintext

tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(10,1): error TS2511: Cannot create an instance of the abstract class 'B'.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(17,5): error TS2511: Cannot create an instance of the abstract class 'B'.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(21,1): error TS2511: Cannot create an instance of the abstract class 'B'.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(26,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'bar' from class 'B'.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(46,5): error TS2391: Function implementation is missing or not immediately following the declaration.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(46,5): error TS2512: Overload signatures must all be abstract or not abstract.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(50,5): error TS1244: Abstract methods can only appear within an abstract class.
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts (7 errors) ====
class A {
// ...
}
abstract class B {
foo(): number { return this.bar(); }
abstract bar() : number;
}
new B; // error
~~~~~
!!! error TS2511: Cannot create an instance of the abstract class 'B'.
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 B.
~~~~~~~~~~~
!!! error TS2511: Cannot create an instance of the abstract class 'B'.
}
var BB = B;
new BB; // error -- BB is of type typeof B.
~~~~~~
!!! error TS2511: Cannot create an instance of the abstract class 'B'.
var x : any = C;
new x; // okay -- undefined behavior at runtime
class C extends B { } // error -- not declared abstract
~
!!! error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'bar' from class 'B'.
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.
~~~
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
~~~
!!! error TS2512: Overload signatures must all be abstract or not abstract.
}
class H { // error -- not declared abstract
abstract baz() : number;
~~~~~~~~
!!! error TS1244: Abstract methods can only appear within an abstract class.
}