==== tests/cases/compiler/subtypesOfTypeParameterWithConstraints.ts (74 errors) ====
    // checking whether other types are subtypes of type parameters with constraints
    
    class C3<T> {
        foo: T;
    }
    
    class D1<T extends U, U> extends C3<T> {
             ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(7,10): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: T;
        foo: T; // ok
    }
    
    class D2<T extends U, U> extends C3<U> {
             ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(12,10): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: U;
        foo: T; // ok
    }
    
    class D3<T extends U, U> extends C3<T> {
          ~~
!!! subtypesOfTypeParameterWithConstraints.ts(17,7): error TS2141: Class 'D3<T, U>' cannot extend class 'C3<T>':
!!! 	Types of property 'foo' of types 'D3<T, U>' and 'C3<T>' are incompatible.
             ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(17,10): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: T;
        foo: U; // error
        ~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(19,5): error TS2171: All named properties must be assignable to string indexer type 'T'.
    }
    
    class D4<T extends U, U> extends C3<U> {
             ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(22,10): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: U;
        foo: U; // ok
    }
    
    
    // V > U > T
    // test if T is subtype of T, U, V
    // should all work
    class D5<T extends U, U extends V, V> extends C3<T> {
             ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(31,10): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                          ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(31,23): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: T;
        foo: T; // ok
    }
    
    class D6<T extends U, U extends V, V> extends C3<U> {
             ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(36,10): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                          ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(36,23): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: U;
        foo: T;
    }
    
    class D7<T extends U, U extends V, V> extends C3<V> {
             ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(41,10): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                          ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(41,23): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: V;
        foo: T; // ok
    }
    
    // test if U is a subtype of T, U, V
    // only a subtype of V and itself
    class D8<T extends U, U extends V, V> extends C3<T> {
          ~~
!!! subtypesOfTypeParameterWithConstraints.ts(48,7): error TS2141: Class 'D8<T, U, V>' cannot extend class 'C3<T>':
!!! 	Types of property 'foo' of types 'D8<T, U, V>' and 'C3<T>' are incompatible.
             ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(48,10): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                          ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(48,23): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: T;
        foo: U; // error
        ~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(50,5): error TS2171: All named properties must be assignable to string indexer type 'T'.
    }
    
    class D9<T extends U, U extends V, V> extends C3<U> {
             ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(53,10): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                          ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(53,23): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: U;
        foo: U; // ok
    }
    
    class D10<T extends U, U extends V, V> extends C3<V> {
              ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(58,11): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                           ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(58,24): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: V;
        foo: U; // ok
    }
    
    // test if V is a subtype of T, U, V
    // only a subtype of itself
    class D11<T extends U, U extends V, V> extends C3<T> {
          ~~~
!!! subtypesOfTypeParameterWithConstraints.ts(65,7): error TS2141: Class 'D11<T, U, V>' cannot extend class 'C3<T>':
!!! 	Types of property 'foo' of types 'D11<T, U, V>' and 'C3<T>' are incompatible.
              ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(65,11): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                           ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(65,24): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: T;
        foo: V; // error
        ~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(67,5): error TS2171: All named properties must be assignable to string indexer type 'T'.
    }
    
    class D12<T extends U, U extends V, V> extends C3<U> {
          ~~~
!!! subtypesOfTypeParameterWithConstraints.ts(70,7): error TS2141: Class 'D12<T, U, V>' cannot extend class 'C3<U>':
!!! 	Types of property 'foo' of types 'D12<T, U, V>' and 'C3<U>' are incompatible.
              ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(70,11): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                           ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(70,24): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: U;
        foo: V; // error
        ~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(72,5): error TS2171: All named properties must be assignable to string indexer type 'U'.
    }
    
    class D13<T extends U, U extends V, V> extends C3<V> {
              ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(75,11): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                           ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(75,24): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: V;
        foo: V; // ok
    }
    
    // Date > V > U > T
    // test if T is subtype of T, U, V, Date
    // should all work
    class D14<T extends U, U extends V, V extends Date> extends C3<Date> {
              ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(83,11): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                           ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(83,24): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: Date;
        foo: T; // ok
    }
    
    class D15<T extends U, U extends V, V extends Date> extends C3<T> {
              ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(88,11): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                           ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(88,24): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: T;
        foo: T; // ok
    }
    
    class D16<T extends U, U extends V, V extends Date> extends C3<U> {
              ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(93,11): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                           ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(93,24): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: U;
        foo: T;
    }
    
    class D17<T extends U, U extends V, V extends Date> extends C3<V> {
              ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(98,11): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                           ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(98,24): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: V;
        foo: T;
    }
    
    // test if U is a subtype of T, U, V, Date
    // only a subtype of V, Date and itself
    class D18<T extends U, U extends V, V extends Date> extends C3<Date> {
              ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(105,11): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                           ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(105,24): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: Date;
        foo: T; // ok
    }
    
    class D19<T extends U, U extends V, V extends Date> extends C3<T> {
          ~~~
!!! subtypesOfTypeParameterWithConstraints.ts(110,7): error TS2141: Class 'D19<T, U, V>' cannot extend class 'C3<T>':
!!! 	Types of property 'foo' of types 'D19<T, U, V>' and 'C3<T>' are incompatible.
              ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(110,11): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                           ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(110,24): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: T;
        foo: U; // error
        ~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(112,5): error TS2171: All named properties must be assignable to string indexer type 'T'.
    }
    
    class D20<T extends U, U extends V, V extends Date> extends C3<U> {
              ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(115,11): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                           ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(115,24): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: U;
        foo: U; // ok
    }
    
    class D21<T extends U, U extends V, V extends Date> extends C3<V> {
              ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(120,11): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                           ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(120,24): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: V;
        foo: U;
    }
    
    // test if V is a subtype of T, U, V, Date
    // only a subtype of itself and Date
    class D22<T extends U, U extends V, V extends Date> extends C3<Date> {
              ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(127,11): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                           ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(127,24): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: Date;
        foo: T; // ok
    }
    
    class D23<T extends U, U extends V, V extends Date> extends C3<T> {
          ~~~
!!! subtypesOfTypeParameterWithConstraints.ts(132,7): error TS2141: Class 'D23<T, U, V>' cannot extend class 'C3<T>':
!!! 	Types of property 'foo' of types 'D23<T, U, V>' and 'C3<T>' are incompatible.
              ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(132,11): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                           ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(132,24): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: T;
        foo: V; // error
        ~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(134,5): error TS2171: All named properties must be assignable to string indexer type 'T'.
    }
    
    class D24<T extends U, U extends V, V extends Date> extends C3<U> {
          ~~~
!!! subtypesOfTypeParameterWithConstraints.ts(137,7): error TS2141: Class 'D24<T, U, V>' cannot extend class 'C3<U>':
!!! 	Types of property 'foo' of types 'D24<T, U, V>' and 'C3<U>' are incompatible.
              ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(137,11): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                           ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(137,24): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: U;
        foo: V; // error
        ~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(139,5): error TS2171: All named properties must be assignable to string indexer type 'U'.
    }
    
    class D25<T extends U, U extends V, V extends Date> extends C3<V> {
              ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(142,11): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                           ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(142,24): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: V;
        foo: V; // ok
    }
    
    // test if Date is a subtype of T, U, V, Date
    // only a subtype of itself
    class D26<T extends U, U extends V, V extends Date> extends C3<Date> {
              ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(149,11): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                           ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(149,24): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: Date;
        foo: Date; // ok
    }
    
    class D27<T extends U, U extends V, V extends Date> extends C3<T> {
          ~~~
!!! subtypesOfTypeParameterWithConstraints.ts(154,7): error TS2141: Class 'D27<T, U, V>' cannot extend class 'C3<T>':
!!! 	Types of property 'foo' of types 'D27<T, U, V>' and 'C3<T>' are incompatible.
              ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(154,11): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                           ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(154,24): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: T;
        foo: Date; // error
        ~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(156,5): error TS2171: All named properties must be assignable to string indexer type 'T'.
    }
    
    class D28<T extends U, U extends V, V extends Date> extends C3<U> {
          ~~~
!!! subtypesOfTypeParameterWithConstraints.ts(159,7): error TS2141: Class 'D28<T, U, V>' cannot extend class 'C3<U>':
!!! 	Types of property 'foo' of types 'D28<T, U, V>' and 'C3<U>' are incompatible.
              ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(159,11): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                           ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(159,24): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: U;
        foo: Date; // error
        ~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(161,5): error TS2171: All named properties must be assignable to string indexer type 'U'.
    }
    
    class D29<T extends U, U extends V, V extends Date> extends C3<V> {
          ~~~
!!! subtypesOfTypeParameterWithConstraints.ts(164,7): error TS2141: Class 'D29<T, U, V>' cannot extend class 'C3<V>':
!!! 	Types of property 'foo' of types 'D29<T, U, V>' and 'C3<V>' are incompatible.
              ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(164,11): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
                           ~~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(164,24): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
        [x: string]: V;
        foo: Date; // error
        ~~~~~~~~~~
!!! subtypesOfTypeParameterWithConstraints.ts(166,5): error TS2171: All named properties must be assignable to string indexer type 'V'.
    }