51 lines
No EOL
1.9 KiB
Text
51 lines
No EOL
1.9 KiB
Text
==== tests/cases/compiler/superAccess2.ts (13 errors) ====
|
|
class P {
|
|
x() { }
|
|
static y() { }
|
|
}
|
|
|
|
class Q extends P {
|
|
xx = super;
|
|
~
|
|
!!! 'super' must be followed by argument list or member access.
|
|
static yy = super; // error for static initializer accessing super
|
|
~
|
|
!!! 'super' must be followed by argument list or member access.
|
|
~~~~~
|
|
!!! 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
|
|
|
// Super is not allowed in constructor args
|
|
constructor(public z = super, zz = super, zzz = () => super) {
|
|
~
|
|
!!! 'super' must be followed by argument list or member access.
|
|
~
|
|
!!! 'super' must be followed by argument list or member access.
|
|
~
|
|
!!! 'super' must be followed by argument list or member access.
|
|
~~~~~
|
|
!!! 'super' cannot be referenced in constructor arguments.
|
|
~~~~~
|
|
!!! 'super' cannot be referenced in constructor arguments.
|
|
~~~~~
|
|
!!! 'super' cannot be referenced in constructor arguments.
|
|
super();
|
|
}
|
|
|
|
foo(zz = super) {
|
|
~
|
|
!!! 'super' must be followed by argument list or member access.
|
|
super.x();
|
|
super.y(); // error
|
|
~
|
|
!!! Property 'y' does not exist on type 'P'.
|
|
}
|
|
|
|
static bar(zz = super) {
|
|
~
|
|
!!! 'super' must be followed by argument list or member access.
|
|
super.x(); // error
|
|
~
|
|
!!! Property 'x' does not exist on type 'typeof P'.
|
|
super.y();
|
|
}
|
|
} |