TypeScript/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.errors.txt
2014-09-23 11:22:38 -07:00

160 lines
12 KiB
Plaintext

tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(13,9): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(26,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(28,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(29,9): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(30,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(42,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(43,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(45,9): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(59,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(60,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(61,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(63,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(75,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(76,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(77,9): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(78,9): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(90,1): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(91,1): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(92,1): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(93,1): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(94,1): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
==== tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts (21 errors) ====
class Base {
protected x: string;
method() {
var b: Base;
var d1: Derived1;
var d2: Derived2;
var d3: Derived3;
var d4: Derived4;
b.x; // OK, accessed within their declaring class
d1.x; // OK, accessed within their declaring class
d2.x; // OK, accessed within their declaring class
d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses
~~~~
!!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
d4.x; // OK, accessed within their declaring class
}
}
class Derived1 extends Base {
method1() {
var b: Base;
var d1: Derived1;
var d2: Derived2;
var d3: Derived3;
var d4: Derived4;
b.x; // Error, isn't accessed through an instance of the enclosing class
~~~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'.
d1.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class
d2.x; // Error, isn't accessed through an instance of the enclosing class
~~~~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'.
d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses
~~~~
!!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
d4.x; // Error, isn't accessed through an instance of the enclosing class
~~~~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'.
}
}
class Derived2 extends Base {
method2() {
var b: Base;
var d1: Derived1;
var d2: Derived2;
var d3: Derived3;
var d4: Derived4;
b.x; // Error, isn't accessed through an instance of the enclosing class
~~~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'.
d1.x; // Error, isn't accessed through an instance of the enclosing class
~~~~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'.
d2.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class
d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses
~~~~
!!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
d4.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class or one of its subclasses
}
}
class Derived3 extends Derived1 {
protected x: string;
method3() {
var b: Base;
var d1: Derived1;
var d2: Derived2;
var d3: Derived3;
var d4: Derived4;
b.x; // Error, isn't accessed through an instance of the enclosing class
~~~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'.
d1.x; // Error, isn't accessed through an instance of the enclosing class
~~~~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'.
d2.x; // Error, isn't accessed through an instance of the enclosing class
~~~~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'.
d3.x; // OK, accessed within their declaring class
d4.x; // Error, isn't accessed through an instance of the enclosing class
~~~~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'.
}
}
class Derived4 extends Derived2 {
method4() {
var b: Base;
var d1: Derived1;
var d2: Derived2;
var d3: Derived3;
var d4: Derived4;
b.x; // Error, isn't accessed through an instance of the enclosing class
~~~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'.
d1.x; // Error, isn't accessed through an instance of the enclosing class
~~~~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'.
d2.x; // Error, isn't accessed through an instance of the enclosing class
~~~~
!!! error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'.
d3.x; // Error, redefined in a subclass, can only be accessed in the declaring class or one of its subclasses
~~~~
!!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
d4.x; // OK, accessed within a class derived from their declaring class, and through an instance of the enclosing class
}
}
var b: Base;
var d1: Derived1;
var d2: Derived2;
var d3: Derived3;
var d4: Derived4;
b.x; // Error, neither within their declaring class nor classes derived from their declaring class
~~~
!!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
d1.x; // Error, neither within their declaring class nor classes derived from their declaring class
~~~~
!!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
d2.x; // Error, neither within their declaring class nor classes derived from their declaring class
~~~~
!!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
d3.x; // Error, neither within their declaring class nor classes derived from their declaring class
~~~~
!!! error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
d4.x; // Error, neither within their declaring class nor classes derived from their declaring class
~~~~
!!! error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.