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

78 lines
No EOL
3.7 KiB
Text

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(49,7): error TS2514: Classes containing abstract methods must be marked abstract.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(50,5): error TS1238: Abstract methods can only appear within an abstract class.
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts (8 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
~
!!! error TS2514: Classes containing abstract methods must be marked abstract.
abstract baz() : number;
~~~~~~~~
!!! error TS1238: Abstract methods can only appear within an abstract class.
}