File: classAbstractInstantiations2.errors.txt

package info (click to toggle)
node-typescript 2.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 203,952 kB
  • ctags: 52,987
  • sloc: sh: 11; makefile: 5
file content (80 lines) | stat: -rw-r--r-- 3,950 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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(13,5): error TS2322: Type 'typeof B' is not assignable to type 'typeof A'.
  Cannot assign an abstract constructor type to a non-abstract constructor type.
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 non-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 (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.
        ~~
!!! error TS2322: Type 'typeof B' is not assignable to type 'typeof A'.
!!! error TS2322:   Cannot assign an abstract constructor type to a non-abstract constructor 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 non-abstract.
    }
    
    class H { // error -- not declared abstract
        abstract baz() : number;
        ~~~~~~~~
!!! error TS1244: Abstract methods can only appear within an abstract class.
    }