60 lines
2.1 KiB
Text
60 lines
2.1 KiB
Text
|
==== tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperCallsInNonConstructorMembers.ts (14 errors) ====
|
||
|
// error to use super calls outside a constructor
|
||
|
|
||
|
class Base {
|
||
|
x: string;
|
||
|
}
|
||
|
|
||
|
class Derived extends Base {
|
||
|
a: super();
|
||
|
~~~~~
|
||
|
!!! Type expected.
|
||
|
~~~~~
|
||
|
!!! Super calls are not permitted outside constructors or in nested functions inside constructors
|
||
|
b() {
|
||
|
super();
|
||
|
~~~~~
|
||
|
!!! Super calls are not permitted outside constructors or in nested functions inside constructors
|
||
|
}
|
||
|
get C() {
|
||
|
~
|
||
|
!!! 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 C(v) {
|
||
|
~
|
||
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||
|
super();
|
||
|
~~~~~
|
||
|
!!! Super calls are not permitted outside constructors or in nested functions inside constructors
|
||
|
}
|
||
|
|
||
|
static a: super();
|
||
|
~~~~~
|
||
|
!!! Type expected.
|
||
|
~~~~~
|
||
|
!!! Super calls are not permitted outside constructors or in nested functions inside constructors
|
||
|
static b() {
|
||
|
super();
|
||
|
~~~~~
|
||
|
!!! Super calls are not permitted outside constructors or in nested functions inside constructors
|
||
|
}
|
||
|
static get C() {
|
||
|
~
|
||
|
!!! 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;
|
||
|
}
|
||
|
static set C(v) {
|
||
|
~
|
||
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||
|
super();
|
||
|
~~~~~
|
||
|
!!! Super calls are not permitted outside constructors or in nested functions inside constructors
|
||
|
}
|
||
|
}
|