TypeScript/tests/baselines/reference/strictModeInConstructor.errors.txt
2014-07-12 17:30:19 -07:00

72 lines
1.7 KiB
Plaintext

==== tests/cases/compiler/strictModeInConstructor.ts (2 errors) ====
class A {
}
class B extends A {
public s: number = 9;
constructor () {
~~~~~~~~~~~~~~~~
"use strict"; // No error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
super();
~~~~~~~~~~~~~~~~
}
~~~~~
!!! 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";
~~~~~~~~~~~~~~~~~~~~~
}
~~~~~
!!! 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";
}
}