File: super.errors.txt

package info (click to toggle)
node-typescript 4.9.5%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 533,908 kB
  • sloc: javascript: 2,018,330; makefile: 7; sh: 1
file content (43 lines) | stat: -rw-r--r-- 920 bytes parent folder | download | duplicates (7)
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
tests/cases/compiler/super.ts(29,9): error TS2335: 'super' can only be referenced in a derived class.


==== tests/cases/compiler/super.ts (1 errors) ====
    class Base {
        constructor() {
            var x;
        }
        public foo() {
            return "base";
        }
    
        public bar() {
            return "basebar";
        }
    }
    
    class Sub1 extends Base {
        public foo() {
            return "sub1" + super.foo() + super.bar();
        }
    }
    
    
    class SubSub1 extends Sub1 {
        public foo() {
            return "subsub1" + super.foo();
        }
    }
    
    class Base2 {
        public foo() {
            super.foo();
            ~~~~~
!!! error TS2335: 'super' can only be referenced in a derived class.
        }
    }
    
    var s = new Sub1();
    var ss = new SubSub1();
    s.foo() + ss.foo();