53 lines
1.7 KiB
Text
53 lines
1.7 KiB
Text
|
==== tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedClassWithPrivateStaticShadowingPublicStatic.ts (9 errors) ====
|
||
|
class Base {
|
||
|
public static x: string;
|
||
|
public static fn(): string {
|
||
|
return '';
|
||
|
}
|
||
|
|
||
|
public static get a() { return 1; }
|
||
|
~
|
||
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||
|
public static set a(v) { }
|
||
|
~
|
||
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||
|
}
|
||
|
|
||
|
// BUG 847404
|
||
|
// should be error
|
||
|
class Derived extends Base {
|
||
|
~~~~~~~
|
||
|
!!! Class static side 'typeof Derived' incorrectly extends base class static side 'typeof Base':
|
||
|
!!! Private property 'x' cannot be reimplemented.
|
||
|
private static x: string;
|
||
|
private static fn(): string {
|
||
|
return '';
|
||
|
}
|
||
|
|
||
|
private static get a() { return 1; }
|
||
|
~
|
||
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||
|
private static set a(v) { }
|
||
|
~
|
||
|
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||
|
}
|
||
|
|
||
|
var r = Base.x; // ok
|
||
|
var r2 = Derived.x; // error
|
||
|
~~~~~~~~~
|
||
|
!!! Property 'Derived.x' is inaccessible.
|
||
|
|
||
|
var r3 = Base.fn(); // ok
|
||
|
var r4 = Derived.fn(); // error
|
||
|
~~~~~~~~~~
|
||
|
!!! Property 'Derived.fn' is inaccessible.
|
||
|
|
||
|
var r5 = Base.a; // ok
|
||
|
Base.a = 2; // ok
|
||
|
|
||
|
var r6 = Derived.a; // error
|
||
|
~~~~~~~~~
|
||
|
!!! Property 'Derived.a' is inaccessible.
|
||
|
Derived.a = 2; // error
|
||
|
~~~~~~~~~
|
||
|
!!! Property 'Derived.a' is inaccessible.
|