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.
245 lines
16 KiB
Plaintext
245 lines
16 KiB
Plaintext
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(6,17): error TS2335: 'super' can only be referenced in a derived class.
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(7,17): error TS2335: 'super' can only be referenced in a derived class.
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(11,17): error TS2335: 'super' can only be referenced in a derived class.
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(12,17): error TS2335: 'super' can only be referenced in a derived class.
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(15,9): error TS2335: 'super' can only be referenced in a derived class.
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(16,9): error TS2335: 'super' can only be referenced in a derived class.
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(21,9): error TS2335: 'super' can only be referenced in a derived class.
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(24,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(25,9): error TS2335: 'super' can only be referenced in a derived class.
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(29,23): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(30,9): error TS2335: 'super' can only be referenced in a derived class.
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(57,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(61,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(64,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(65,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(68,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(69,19): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(73,13): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(76,40): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(87,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(91,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(94,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(95,23): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(98,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(99,19): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(109,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(110,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(111,9): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'.
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(113,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(114,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(115,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(116,9): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'.
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(119,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(120,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(121,15): error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(122,9): error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'.
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(127,16): error TS2335: 'super' can only be referenced in a derived class.
|
|
tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts(127,30): error TS2335: 'super' can only be referenced in a derived class.
|
|
|
|
|
|
==== tests/cases/conformance/expressions/superPropertyAccess/errorSuperPropertyAccess.ts (38 errors) ====
|
|
//super property access in constructor of class with no base type
|
|
//super property access in instance member function of class with no base type
|
|
//super property access in instance member accessor(get and set) of class with no base type
|
|
class NoBase {
|
|
constructor() {
|
|
var a = super.prototype;
|
|
~~~~~
|
|
!!! error TS2335: 'super' can only be referenced in a derived class.
|
|
var b = super.hasOwnProperty('');
|
|
~~~~~
|
|
!!! error TS2335: 'super' can only be referenced in a derived class.
|
|
}
|
|
|
|
fn() {
|
|
var a = super.prototype;
|
|
~~~~~
|
|
!!! error TS2335: 'super' can only be referenced in a derived class.
|
|
var b = super.hasOwnProperty('');
|
|
~~~~~
|
|
!!! error TS2335: 'super' can only be referenced in a derived class.
|
|
}
|
|
|
|
m = super.prototype;
|
|
~~~~~
|
|
!!! error TS2335: 'super' can only be referenced in a derived class.
|
|
n = super.hasOwnProperty('');
|
|
~~~~~
|
|
!!! error TS2335: 'super' can only be referenced in a derived class.
|
|
|
|
//super static property access in static member function of class with no base type
|
|
//super static property access in static member accessor(get and set) of class with no base type
|
|
public static static1() {
|
|
super.hasOwnProperty('');
|
|
~~~~~
|
|
!!! error TS2335: 'super' can only be referenced in a derived class.
|
|
}
|
|
|
|
public static get static2() {
|
|
~~~~~~~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
super.hasOwnProperty('');
|
|
~~~~~
|
|
!!! error TS2335: 'super' can only be referenced in a derived class.
|
|
return '';
|
|
}
|
|
|
|
public static set static2(n) {
|
|
~~~~~~~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
super.hasOwnProperty('');
|
|
~~~~~
|
|
!!! error TS2335: 'super' can only be referenced in a derived class.
|
|
}
|
|
}
|
|
|
|
class SomeBase {
|
|
private privateFunc() { }
|
|
private privateMember = 0;
|
|
|
|
public publicFunc() { }
|
|
public publicMember = 0;
|
|
|
|
private static privateStaticFunc() { }
|
|
private static privateStaticMember = 0;
|
|
|
|
public static publicStaticFunc() { }
|
|
public static publicStaticMember = 0;
|
|
|
|
}
|
|
|
|
|
|
//super.publicInstanceMemberNotFunction in constructor of derived class
|
|
//super.publicInstanceMemberNotFunction in instance member function of derived class
|
|
//super.publicInstanceMemberNotFunction in instance member accessor(get and set) of derived class
|
|
//super property access only available with typed this
|
|
class SomeDerived1 extends SomeBase {
|
|
constructor() {
|
|
super();
|
|
super.publicMember = 1;
|
|
~~~~~~~~~~~~
|
|
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
}
|
|
|
|
fn() {
|
|
var x = super.publicMember;
|
|
~~~~~~~~~~~~
|
|
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
}
|
|
|
|
get a() {
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
var x = super.publicMember;
|
|
~~~~~~~~~~~~
|
|
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
return undefined;
|
|
}
|
|
set a(n) {
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
n = super.publicMember;
|
|
~~~~~~~~~~~~
|
|
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
}
|
|
fn2() {
|
|
function inner() {
|
|
super.publicFunc();
|
|
~~~~~
|
|
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
|
}
|
|
var x = {
|
|
test: function () { return super.publicFunc(); }
|
|
~~~~~
|
|
!!! error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class
|
|
}
|
|
}
|
|
}
|
|
|
|
//super.privateProperty in constructor of derived class
|
|
//super.privateProperty in instance member function of derived class
|
|
//super.privateProperty in instance member accessor(get and set) of derived class
|
|
class SomeDerived2 extends SomeBase {
|
|
constructor() {
|
|
super();
|
|
super.privateMember = 1;
|
|
~~~~~~~~~~~~~
|
|
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
}
|
|
|
|
fn() {
|
|
var x = super.privateMember;
|
|
~~~~~~~~~~~~~
|
|
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
}
|
|
|
|
get a() {
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
var x = super.privateMember;
|
|
~~~~~~~~~~~~~
|
|
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
return undefined;
|
|
}
|
|
set a(n) {
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
n = super.privateMember;
|
|
~~~~~~~~~~~~~
|
|
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
}
|
|
}
|
|
|
|
//super.publicStaticMemberNotFunction in static member function of derived class
|
|
//super.publicStaticMemberNotFunction in static member accessor(get and set) of derived class
|
|
//super.privateStaticProperty in static member function of derived class
|
|
//super.privateStaticProperty in static member accessor(get and set) of derived class
|
|
class SomeDerived3 extends SomeBase {
|
|
static fn() {
|
|
super.publicStaticMember = 3;
|
|
~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
super.privateStaticMember = 3;
|
|
~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
super.privateStaticFunc();
|
|
~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'.
|
|
}
|
|
static get a() {
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
super.publicStaticMember = 3;
|
|
~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
super.privateStaticMember = 3;
|
|
~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
super.privateStaticFunc();
|
|
~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'.
|
|
return '';
|
|
}
|
|
static set a(n) {
|
|
~
|
|
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
|
super.publicStaticMember = 3;
|
|
~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
super.privateStaticMember = 3;
|
|
~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword
|
|
super.privateStaticFunc();
|
|
~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2341: Property 'privateStaticFunc' is private and only accessible within class 'SomeBase'.
|
|
}
|
|
}
|
|
|
|
// In object literal
|
|
var obj = { n: super.wat, p: super.foo() };
|
|
~~~~~
|
|
!!! error TS2335: 'super' can only be referenced in a derived class.
|
|
~~~~~
|
|
!!! error TS2335: 'super' can only be referenced in a derived class.
|
|
|