f1a2e41a8a
This was we don't get noisy baselines just because a different phase of the compiler reported the diagnostic. This helps with Yui's refactoring work to move grammar checks into the type checker.
102 lines
No EOL
5.8 KiB
Text
102 lines
No EOL
5.8 KiB
Text
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.
|
|
|
|
|
|
==== 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;
|
|
~~~~~
|
|
!!! 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;
|
|
~~~~~
|
|
!!! error TS2335: 'super' can only be referenced in a derived class.
|
|
~
|
|
!!! error TS1034: 'super' must be followed by an argument list or member access.
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
// 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
|
|
}
|
|
|
|
// 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.
|
|
}
|
|
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
|
|
}
|
|
|
|
// 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.
|
|
}
|
|
static staticFunction(): void {
|
|
// super in static functions
|
|
var s = super;
|
|
~
|
|
!!! error TS1034: 'super' must be followed by an argument list or member access.
|
|
var x = () => super;
|
|
~
|
|
!!! error TS1034: 'super' must be followed by an argument list or member access.
|
|
var y = () => () => () => super;
|
|
~
|
|
!!! error TS1034: 'super' must be followed by an argument list or member access.
|
|
}
|
|
} |