2014-09-12 22:35:07 +02:00
|
|
|
tests/cases/compiler/privateVisibility.ts(9,1): error TS2341: Property 'Foo.privMeth' is inaccessible.
|
|
|
|
tests/cases/compiler/privateVisibility.ts(10,1): error TS2341: Property 'Foo.privProp' is inaccessible.
|
|
|
|
tests/cases/compiler/privateVisibility.ts(24,1): error TS2341: Property 'M.C.priv' is inaccessible.
|
|
|
|
|
|
|
|
|
2014-07-13 01:04:16 +02:00
|
|
|
==== tests/cases/compiler/privateVisibility.ts (3 errors) ====
|
|
|
|
class Foo {
|
|
|
|
public pubMeth() {this.privMeth();}
|
|
|
|
private privMeth() {}
|
|
|
|
public pubProp = 0;
|
|
|
|
private privProp = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
var f = new Foo();
|
|
|
|
f.privMeth(); // should not work
|
|
|
|
~~~~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2341: Property 'Foo.privMeth' is inaccessible.
|
2014-07-13 01:04:16 +02:00
|
|
|
f.privProp; // should not work
|
|
|
|
~~~~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2341: Property 'Foo.privProp' is inaccessible.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
f.pubMeth(); // should work
|
|
|
|
f.pubProp; // should work
|
|
|
|
|
|
|
|
module M {
|
|
|
|
export class C { public pub = 0; private priv = 1; }
|
|
|
|
export var V = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var c = new M.C();
|
|
|
|
|
|
|
|
c.pub; // should work
|
|
|
|
c.priv; // should not work
|
|
|
|
~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2341: Property 'M.C.priv' is inaccessible.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
|