tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(13,12): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(26,11): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. This is an instance of class 'Base'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(28,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. This is an instance of class 'Derived2'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(29,12): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(30,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived1'. This is an instance of class 'Derived4'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(42,11): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'. This is an instance of class 'Base'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(43,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived2'. This is an instance of class 'Derived1'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(45,12): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(59,11): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. This is an instance of class 'Base'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(60,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. This is an instance of class 'Derived1'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(61,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. This is an instance of class 'Derived2'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(63,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived3'. This is an instance of class 'Derived4'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(75,11): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. This is an instance of class 'Base'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(76,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. This is an instance of class 'Derived1'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(77,12): error TS2446: Property 'x' is protected and only accessible through an instance of class 'Derived4'. This is an instance of class 'Derived2'.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(78,12): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(90,3): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(91,4): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(92,4): error TS2445: Property 'x' is protected and only accessible within class 'Base' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(93,4): error TS2445: Property 'x' is protected and only accessible within class 'Derived3' and its subclasses.
tests/cases/conformance/classes/members/accessibility/protectedClassPropertyAccessibleWithinSubclass2.ts(94,4): 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'. This is an instance of class 'Base'.
            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'. This is an instance of class 'Derived2'.
            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'. This is an instance of class 'Derived4'.
        }
    }
    
    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'. This is an instance of class 'Base'.
            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'. This is an instance of class 'Derived1'.
            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'. This is an instance of class 'Base'.
            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'. This is an instance of class 'Derived1'.
            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'. This is an instance of class 'Derived2'.
            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'. This is an instance of class 'Derived4'.
        }
    }
    
    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'. This is an instance of class 'Base'.
            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'. This is an instance of class 'Derived1'.
            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'. This is an instance of class 'Derived2'.
            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.