File: baseCheck.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 (61 lines) | stat: -rw-r--r-- 3,042 bytes parent folder | download
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
tests/cases/compiler/baseCheck.ts(9,18): error TS2552: Cannot find name 'loc'. Did you mean 'Lock'?
tests/cases/compiler/baseCheck.ts(17,53): error TS2554: Expected 2 arguments, but got 1.
tests/cases/compiler/baseCheck.ts(17,59): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/baseCheck.ts(18,62): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/baseCheck.ts(19,59): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
tests/cases/compiler/baseCheck.ts(19,68): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/baseCheck.ts(22,9): error TS2304: Cannot find name 'x'.
tests/cases/compiler/baseCheck.ts(23,7): error TS2304: Cannot find name 'x'.
tests/cases/compiler/baseCheck.ts(26,9): error TS2304: Cannot find name 'x'.


==== tests/cases/compiler/baseCheck.ts (9 errors) ====
    class C { constructor(x: number, y: number) { } }
    class ELoc extends C {
        constructor(x: number) {
            super(0, x);
        }
    }
    class ELocVar extends C {  
        constructor(x: number) {
            super(0, loc);
                     ~~~
!!! error TS2552: Cannot find name 'loc'. Did you mean 'Lock'?
!!! related TS2728 /.ts/lib.dom.d.ts:9275:13: 'Lock' is declared here.
        }
    
        m() {
            var loc=10;
        }
    }
    
    class D extends C { constructor(public z: number) { super(this.z) }  } // too few params
                                                        ~~~~~~~~~~~~~
!!! error TS2554: Expected 2 arguments, but got 1.
!!! related TS6210 tests/cases/compiler/baseCheck.ts:1:34: An argument for 'y' was not provided.
                                                              ~~~~
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
    class E extends C { constructor(public z: number) { super(0, this.z) } }
                                                                 ~~~~
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
    class F extends C { constructor(public z: number) { super("hello", this.z) } } // first param type
                                                              ~~~~~~~
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
                                                                       ~~~~
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
    
    function f() {
        if (x<10) {
            ~
!!! error TS2304: Cannot find name 'x'.
          x=11;
          ~
!!! error TS2304: Cannot find name 'x'.
        }
        else {
            x=12;
            ~
!!! error TS2304: Cannot find name 'x'.
        }
    }