TypeScript/tests/baselines/reference/superErrors.errors.txt

102 lines
5.8 KiB
Plaintext
Raw Normal View History

tests/cases/compiler/superErrors.ts(3,13): error TS2335: 'super' can only be referenced in a derived class.
tests/cases/compiler/superErrors.ts(3,18): error TS1034: 'super' must be followed by an argument list or member access.
tests/cases/compiler/superErrors.ts(4,19): error TS2335: 'super' can only be referenced in a derived class.
tests/cases/compiler/superErrors.ts(4,24): error TS1034: 'super' must be followed by an argument list or member access.
tests/cases/compiler/superErrors.ts(5,31): error TS2335: 'super' can only be referenced in a derived class.
tests/cases/compiler/superErrors.ts(5,36): error TS1034: 'super' must be followed by an argument list or member access.
tests/cases/compiler/superErrors.ts(22,13): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
tests/cases/compiler/superErrors.ts(27,27): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
tests/cases/compiler/superErrors.ts(31,36): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
tests/cases/compiler/superErrors.ts(31,41): error TS1034: 'super' must be followed by an argument list or member access.
tests/cases/compiler/superErrors.ts(39,27): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
tests/cases/compiler/superErrors.ts(43,36): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
tests/cases/compiler/superErrors.ts(43,41): error TS1034: 'super' must be followed by an argument list or member access.
tests/cases/compiler/superErrors.ts(47,22): error TS1034: 'super' must be followed by an argument list or member access.
tests/cases/compiler/superErrors.ts(48,28): error TS1034: 'super' must be followed by an argument list or member access.
tests/cases/compiler/superErrors.ts(49,40): error TS1034: 'super' must be followed by an argument list or member access.
2014-07-13 01:04:16 +02:00
==== tests/cases/compiler/superErrors.ts (16 errors) ====
function foo() {
// super in a non class context
var x = super;
~~~~~
!!! error TS2335: 'super' can only be referenced in a derived class.
~
!!! error TS1034: 'super' must be followed by an argument list or member access.
var y = () => super;
2014-07-13 01:04:16 +02:00
~~~~~
!!! error TS2335: 'super' can only be referenced in a derived class.
~
!!! error TS1034: 'super' must be followed by an argument list or member access.
var z = () => () => () => super;
2014-07-13 01:04:16 +02:00
~~~~~
!!! error TS2335: 'super' can only be referenced in a derived class.
~
!!! error TS1034: 'super' must be followed by an argument list or member access.
2014-07-13 01:04:16 +02:00
}
class User {
name: string = "Bob";
sayHello(): void {
//console.log("Hello, " + this.name);
}
}
class RegisteredUser extends User {
name: string = "Frank";
constructor() {
super();
// super call in an inner function in a constructor
function inner() {
super.sayHello();
~~~~~
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
2014-07-13 01:04:16 +02:00
}
// super call in a lambda in an inner function in a constructor
function inner2() {
var x = () => super.sayHello();
~~~~~
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
2014-07-13 01:04:16 +02:00
}
// super call in a lambda in a function expression in a constructor
(function() { return () => super; })();
~~~~~
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
~
!!! error TS1034: 'super' must be followed by an argument list or member access.
2014-07-13 01:04:16 +02:00
}
sayHello(): void {
// super call in a method
super.sayHello();
// super call in a lambda in an inner function in a method
function inner() {
var x = () => super.sayHello();
~~~~~
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
2014-07-13 01:04:16 +02:00
}
// super call in a lambda in a function expression in a constructor
(function() { return () => super; })();
~~~~~
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
~
!!! error TS1034: 'super' must be followed by an argument list or member access.
2014-07-13 01:04:16 +02:00
}
static staticFunction(): void {
// super in static functions
var s = super;
~
!!! error TS1034: 'super' must be followed by an argument list or member access.
2014-07-13 01:04:16 +02:00
var x = () => super;
~
!!! error TS1034: 'super' must be followed by an argument list or member access.
2014-07-13 01:04:16 +02:00
var y = () => () => () => super;
~
!!! error TS1034: 'super' must be followed by an argument list or member access.
2014-07-13 01:04:16 +02:00
}
}