==== tests/cases/compiler/subtypesOfTypeParameter.ts (38 errors) ====
    // checking whether other types are subtypes of type parameters
    
    class C3<T> {
        foo: T;
    }
    
    class D1<T, U> extends C3<T> {
          ~~
!!! subtypesOfTypeParameter.ts(7,7): error TS2141: Class 'D1<T, U>' cannot extend class 'C3<T>':
!!! 	Types of property 'foo' of types 'D1<T, U>' and 'C3<T>' are incompatible.
        foo: U; // error
    }
    
    function f1<T, U>(x: T, y: U) {
        var r = true ? x : y; // error
                ~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(12,13): error TS2226: Type of conditional '{}' must be identical to 'T' or 'U'.
        var r = true ? y : x; // error
                ~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(13,13): error TS2226: Type of conditional '{}' must be identical to 'U' or 'T'.
    }
    
    interface I1 { foo: number; }
    class C1 { foo: number; }
    class C2<T> { foo: T; }
    enum E { A }
    function f() { }
    module f {
        export var bar = 1;
    }
    class c { baz: string }
    module c {
        export var bar = 1;
    }
    
    // errors throughout
    function f2<T, U>(x: T, y: U) {
        var r0 = true ? x : null;
        var r0 = true ? null : x;
    
        var u: typeof undefined;
        var r0b = true ? u : x;
        var r0b = true ? x : u;
    
        var r1 = true ? 1 : x; 
                 ~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(38,14): error TS2226: Type of conditional '{}' must be identical to 'number' or 'T'.
        var r1 = true ? x : 1;
                 ~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(39,14): error TS2226: Type of conditional '{}' must be identical to 'T' or 'number'.
    
        var r2 = true ? '' : x;
                 ~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(41,14): error TS2226: Type of conditional '{}' must be identical to 'string' or 'T'.
        var r2 = true ? x : '';
                 ~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(42,14): error TS2226: Type of conditional '{}' must be identical to 'T' or 'string'.
    
        var r3 = true ? true : x;
                 ~~~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(44,14): error TS2226: Type of conditional '{}' must be identical to 'boolean' or 'T'.
        var r3 = true ? x : true;
                 ~~~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(45,14): error TS2226: Type of conditional '{}' must be identical to 'T' or 'boolean'.
    
        var r4 = true ? new Date() : x;
                 ~~~~~~~~~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(47,14): error TS2226: Type of conditional '{}' must be identical to 'Date' or 'T'.
        var r4 = true ? x : new Date();
                 ~~~~~~~~~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(48,14): error TS2226: Type of conditional '{}' must be identical to 'T' or 'Date'.
    
        var r5 = true ? /1/ : x;
                 ~~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(50,14): error TS2226: Type of conditional '{}' must be identical to 'RegExp' or 'T'.
        var r5 = true ? x : /1/;
                 ~~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(51,14): error TS2226: Type of conditional '{}' must be identical to 'T' or 'RegExp'.
    
        var r6 = true ? { foo: 1 } : x;
                 ~~~~~~~~~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(53,14): error TS2226: Type of conditional '{}' must be identical to '{ foo: number; }' or 'T'.
        var r6 = true ? x : { foo: 1 };
                 ~~~~~~~~~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(54,14): error TS2226: Type of conditional '{}' must be identical to 'T' or '{ foo: number; }'.
    
        var r7 = true ? () => { } : x;
                 ~~~~~~~~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(56,14): error TS2226: Type of conditional '{}' must be identical to '() => void' or 'T'.
        var r7 = true ? x : () => { };
                 ~~~~~~~~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(57,14): error TS2226: Type of conditional '{}' must be identical to 'T' or '() => void'.
    
        var r8 = true ? <T>(x: T) => { return x } : x;
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(59,14): error TS2226: Type of conditional '{}' must be identical to '<T>(x: T) => T' or 'T'.
        var r8b = true ? x : <T>(x: T) => { return x }; // type parameters not identical across declarations
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(60,15): error TS2226: Type of conditional '{}' must be identical to 'T' or '<T>(x: T) => T'.
    
        var i1: I1;
        var r9 = true ? i1 : x;
                 ~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(63,14): error TS2226: Type of conditional '{}' must be identical to 'I1' or 'T'.
        var r9 = true ? x : i1;
                 ~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(64,14): error TS2226: Type of conditional '{}' must be identical to 'T' or 'I1'.
    
        var c1: C1;
        var r10 = true ? c1 : x;
                  ~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(67,15): error TS2226: Type of conditional '{}' must be identical to 'C1' or 'T'.
        var r10 = true ? x : c1;
                  ~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(68,15): error TS2226: Type of conditional '{}' must be identical to 'T' or 'C1'.
    
    
        var c2: C2<number>;
        var r12 = true ? c2 : x;
                  ~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(72,15): error TS2226: Type of conditional '{}' must be identical to 'C2<number>' or 'T'.
        var r12 = true ? x : c2;
                  ~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(73,15): error TS2226: Type of conditional '{}' must be identical to 'T' or 'C2<number>'.
    
    
        var r13 = true ? E : x;
                  ~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(76,15): error TS2226: Type of conditional '{}' must be identical to 'typeof E' or 'T'.
        var r13 = true ? x : E;
                  ~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(77,15): error TS2226: Type of conditional '{}' must be identical to 'T' or 'typeof E'.
    
        var r14 = true ? E.A : x;
                  ~~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(79,15): error TS2226: Type of conditional '{}' must be identical to 'E' or 'T'.
        var r14 = true ? x : E.A;
                  ~~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(80,15): error TS2226: Type of conditional '{}' must be identical to 'T' or 'E'.
    
        var af: typeof f;
        var r15 = true ? af : x;
                  ~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(83,15): error TS2226: Type of conditional '{}' must be identical to 'typeof f' or 'T'.
        var r15 = true ? x : af;
                  ~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(84,15): error TS2226: Type of conditional '{}' must be identical to 'T' or 'typeof f'.
    
        var ac: typeof c;
        var r16 = true ? ac : x;
                  ~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(87,15): error TS2226: Type of conditional '{}' must be identical to 'typeof c' or 'T'.
        var r16 = true ? x : ac;
                  ~~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(88,15): error TS2226: Type of conditional '{}' must be identical to 'T' or 'typeof c'.
    
        function f17<T>(a: T) {
            var r17 = true ? x : a;
                      ~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(91,19): error TS2226: Type of conditional '{}' must be identical to 'T' or 'T'.
            var r17 = true ? a : x;
                      ~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(92,19): error TS2226: Type of conditional '{}' must be identical to 'T' or 'T'.
        }
    
        function f18<T, U extends T>(a: U) {
                        ~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(95,21): error TS2229: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
            var r18 = true ? x : a;
                      ~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(96,19): error TS2226: Type of conditional '{}' must be identical to 'T' or 'U'.
            var r18 = true ? a : x;
                      ~~~~~~~~~~~~
!!! subtypesOfTypeParameter.ts(97,19): error TS2226: Type of conditional '{}' must be identical to 'U' or 'T'.
        }
    
        var r19 = true ? new Object() : x; // BCT is Object
        var r19 = true ? x : new Object(); // BCT is Object
    
        var r20 = true ? {} : x; // ok
        var r20 = true ? x : {}; // ok
    }