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

38 lines
1.3 KiB
Plaintext
Raw Normal View History

2014-09-19 15:37:55 +02:00
tests/cases/compiler/privateVisibility.ts(9,1): error TS2341: Property 'privMeth' is private and only accessible within class 'Foo'.
tests/cases/compiler/privateVisibility.ts(10,1): error TS2341: Property 'privProp' is private and only accessible within class 'Foo'.
tests/cases/compiler/privateVisibility.ts(24,1): error TS2341: Property 'priv' is private and only accessible within class 'C'.
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-19 15:37:55 +02:00
!!! error TS2341: Property 'privMeth' is private and only accessible within class 'Foo'.
2014-07-13 01:04:16 +02:00
f.privProp; // should not work
~~~~~~~~~~
2014-09-19 15:37:55 +02:00
!!! error TS2341: Property 'privProp' is private and only accessible within class 'Foo'.
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-19 15:37:55 +02:00
!!! error TS2341: Property 'priv' is private and only accessible within class 'C'.
2014-07-13 01:04:16 +02:00