59 lines
No EOL
2.8 KiB
Text
59 lines
No EOL
2.8 KiB
Text
tests/cases/compiler/baseCheck.ts(9,18): error TS2304: Cannot find name 'loc'.
|
|
tests/cases/compiler/baseCheck.ts(17,53): error TS2346: Supplied parameters do not match any signature of call target.
|
|
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 TS2304: Cannot find name 'loc'.
|
|
}
|
|
|
|
m() {
|
|
var loc=10;
|
|
}
|
|
}
|
|
|
|
class D extends C { constructor(public z: number) { super(this.z) } } // too few params
|
|
~~~~~~~~~~~~~
|
|
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
|
~~~~
|
|
!!! 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'.
|
|
}
|
|
}
|
|
|