TypeScript/tests/baselines/reference/strictModeInConstructor.errors.txt
2014-09-12 13:35:07 -07:00

76 lines
2.1 KiB
Plaintext

tests/cases/compiler/strictModeInConstructor.ts(9,5): error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.
tests/cases/compiler/strictModeInConstructor.ts(27,5): error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.
==== tests/cases/compiler/strictModeInConstructor.ts (2 errors) ====
class A {
}
class B extends A {
public s: number = 9;
constructor () {
~~~~~~~~~~~~~~~~
"use strict"; // No error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
super();
~~~~~~~~~~~~~~~~
}
~~~~~
!!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.
}
class C extends A {
public s: number = 9;
constructor () {
super(); // No error
"use strict";
}
}
class D extends A {
public s: number = 9;
constructor () {
~~~~~~~~~~~~~~~~
var x = 1; // Error
~~~~~~~~~~~~~~~~~~~~~~~~~~~
super();
~~~~~~~~~~~~~~~~
"use strict";
~~~~~~~~~~~~~~~~~~~~~
}
~~~~~
!!! error TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties.
}
class Bs extends A {
public static s: number = 9;
constructor () {
"use strict"; // No error
super();
}
}
class Cs extends A {
public static s: number = 9;
constructor () {
super(); // No error
"use strict";
}
}
class Ds extends A {
public static s: number = 9;
constructor () {
var x = 1; // no Error
super();
"use strict";
}
}