50 lines
1.8 KiB
Plaintext
50 lines
1.8 KiB
Plaintext
|
==== tests/cases/compiler/illegalSuperCallsInConstructor.ts (8 errors) ====
|
||
|
class Base {
|
||
|
x: string;
|
||
|
}
|
||
|
|
||
|
class Derived extends Base {
|
||
|
constructor() {
|
||
|
~~~~~~~~~~~~~~~
|
||
|
var r2 = () => super();
|
||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
~~~~~
|
||
|
!!! Super calls are not permitted outside constructors or in nested functions inside constructors
|
||
|
var r3 = () => { super(); }
|
||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
~~~~~
|
||
|
!!! Super calls are not permitted outside constructors or in nested functions inside constructors
|
||
|
var r4 = function () { super(); }
|
||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
~~~~~
|
||
|
!!! Super calls are not permitted outside constructors or in nested functions inside constructors
|
||
|
var r5 = {
|
||
|
~~~~~~~~~~~~~~~~~~
|
||
|
get foo() {
|
||
|
~~~
|
||
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
super();
|
||
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
~~~~~
|
||
|
!!! Super calls are not permitted outside constructors or in nested functions inside constructors
|
||
|
return 1;
|
||
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
},
|
||
|
~~~~~~~~~~~~~~
|
||
|
set foo(v: number) {
|
||
|
~~~
|
||
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
super();
|
||
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
~~~~~
|
||
|
!!! Super calls are not permitted outside constructors or in nested functions inside constructors
|
||
|
}
|
||
|
~~~~~~~~~~~~~
|
||
|
}
|
||
|
~~~~~~~~~
|
||
|
}
|
||
|
~~~~~
|
||
|
!!! Constructors for derived classes must contain a 'super' call.
|
||
|
}
|