callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(4,35): error TS2322: Type 'null' is not assignable to type 'T'.
  'T' could be instantiated with an arbitrary type which could be unrelated to 'null'.
callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(5,12): error TS2558: Expected 2 type arguments, but got 1.
callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(6,13): error TS2558: Expected 2 type arguments, but got 3.
callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(8,37): error TS2322: Type 'null' is not assignable to type 'T'.
  'T' could be instantiated with an arbitrary type which could be unrelated to 'null'.
callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(9,13): error TS2558: Expected 2 type arguments, but got 1.
callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(10,14): error TS2558: Expected 2 type arguments, but got 3.
callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(13,13): error TS2558: Expected 2 type arguments, but got 1.
callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(14,14): error TS2558: Expected 2 type arguments, but got 3.
callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(18,9): error TS2322: Type 'null' is not assignable to type 'T'.
  'T' could be instantiated with an arbitrary type which could be unrelated to 'null'.
callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(21,22): error TS2558: Expected 2 type arguments, but got 1.
callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(22,23): error TS2558: Expected 2 type arguments, but got 3.
callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(28,14): error TS2558: Expected 2 type arguments, but got 1.
callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(29,15): error TS2558: Expected 2 type arguments, but got 3.
callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(33,9): error TS2322: Type 'null' is not assignable to type 'T'.
  'T' could be instantiated with an arbitrary type which could be unrelated to 'null'.
callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(36,23): error TS2558: Expected 0 type arguments, but got 1.
callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(37,24): error TS2558: Expected 0 type arguments, but got 3.
callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(43,15): error TS2558: Expected 0 type arguments, but got 1.
callGenericFunctionWithIncorrectNumberOfTypeArguments.ts(44,16): error TS2558: Expected 0 type arguments, but got 3.


==== callGenericFunctionWithIncorrectNumberOfTypeArguments.ts (18 errors) ====
    // type parameter lists must exactly match type argument lists
    // all of these invocations are errors
    
    function f<T, U>(x: T, y: U): T { return null; }
                                      ~~~~~~
!!! error TS2322: Type 'null' is not assignable to type 'T'.
!!! error TS2322:   'T' could be instantiated with an arbitrary type which could be unrelated to 'null'.
    var r1 = f<number>(1, '');
               ~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 1.
    var r1b = f<number, string, number>(1, '');
                ~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 3.
    
    var f2 = <T, U>(x: T, y: U): T => { return null; }
                                        ~~~~~~
!!! error TS2322: Type 'null' is not assignable to type 'T'.
!!! error TS2322:   'T' could be instantiated with an arbitrary type which could be unrelated to 'null'.
    var r2 = f2<number>(1, '');
                ~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 1.
    var r2b = f2<number, string, number>(1, '');
                 ~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 3.
    
    declare var f3: { <T, U>(x: T, y: U): T; };
    var r3 = f3<number>(1, '');
                ~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 1.
    var r3b = f3<number, string, number>(1, '');
                 ~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 3.
    
    class C {
        f<T, U>(x: T, y: U): T {
            return null;
            ~~~~~~
!!! error TS2322: Type 'null' is not assignable to type 'T'.
!!! error TS2322:   'T' could be instantiated with an arbitrary type which could be unrelated to 'null'.
        }
    }
    var r4 = (new C()).f<number>(1, '');
                         ~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 1.
    var r4b = (new C()).f<number, string, number>(1, '');
                          ~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 3.
    
    interface I {
        f<T, U>(x: T, y: U): T;
    }
    declare var i: I;
    var r5 = i.f<number>(1, '');
                 ~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 1.
    var r5b = i.f<number, string, number>(1, '');
                  ~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 2 type arguments, but got 3.
    
    class C2<T, U> {
        f(x: T, y: U): T {
            return null;
            ~~~~~~
!!! error TS2322: Type 'null' is not assignable to type 'T'.
!!! error TS2322:   'T' could be instantiated with an arbitrary type which could be unrelated to 'null'.
        }
    }
    var r6 = (new C2()).f<number>(1, '');
                          ~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
    var r6b = (new C2()).f<number, string, number>(1, '');
                           ~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 3.
    
    interface I2<T, U> {
        f(x: T, y: U): T;
    }
    declare var i2: I2<number, string>;
    var r7 = i2.f<number>(1, '');
                  ~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
    var r7b = i2.f<number, string, number>(1, '');
                   ~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 3.