==== tests/cases/compiler/genericCallWithGenericSignatureArguments2.ts (8 errors) ====
    // When a function expression is inferentially typed (section 4.9.3) and a type assigned to a parameter in that expression references type parameters for which inferences are being made, 
    // the corresponding inferred type arguments to become fixed and no further candidate inferences are made for them.
    
    function foo<T>(a: (x: T) => T, b: (x: T) => T) {
        var r: (x: T) => T;
        return r;
    }
    
    var r1: (x: {}) => {} = foo((x: number) => 1, (x: string) => '');
    
    function other2<T extends Date>(x: T) {
        var r7 = foo((a: T) => a, (b: T) => b); // T => T
        // BUG 835518
        var r9 = r7(new Date()); // should be ok
                 ~~
!!! genericCallWithGenericSignatureArguments2.ts(14,14): error TS2082: Supplied parameters do not match any signature of call target:
!!! 	Could not apply type 'T' to argument 1 which is of type 'Date'.
                 ~~
!!! genericCallWithGenericSignatureArguments2.ts(14,14): error TS2087: Could not select overload for 'call' expression.
        var r10 = r7(1); // error
                  ~~
!!! genericCallWithGenericSignatureArguments2.ts(15,15): error TS2082: Supplied parameters do not match any signature of call target:
!!! 	Could not apply type 'T' to argument 1 which is of type 'number'.
                  ~~
!!! genericCallWithGenericSignatureArguments2.ts(15,15): error TS2087: Could not select overload for 'call' expression.
    }
    
    function foo2<T extends Date>(a: (x: T) => T, b: (x: T) => T) {
        var r: (x: T) => T;
        return r;
    }
    
    function other3<T extends RegExp>(x: T) {
        var r7 = foo2((a: T) => a, (b: T) => b); // error
                 ~~~~
!!! genericCallWithGenericSignatureArguments2.ts(24,14): error TS2082: Supplied parameters do not match any signature of call target:
!!! 	Call signatures of types '(a: T) => T' and '(x: Date) => Date' are incompatible:
!!! 		Type 'RegExp' is missing property 'toDateString' from type 'Date'.
                 ~~~~
!!! genericCallWithGenericSignatureArguments2.ts(24,14): error TS2087: Could not select overload for 'call' expression.
        var r7b = foo2((a) => a, (b) => b); // valid, T is inferred to be Date
    }
    
    enum E { A }
    enum F { A }
    
    function foo3<T>(x: T, a: (x: T) => T, b: (x: T) => T) {
        var r: (x: T) => T;
        return r;
    }
    
    var r7 = foo3(E.A, (x) => E.A, (x) => F.A); // error
             ~~~~
!!! genericCallWithGenericSignatureArguments2.ts(36,10): error TS2082: Supplied parameters do not match any signature of call target:
!!! 	Call signatures of types '(x: E) => F' and '(x: E) => E' are incompatible.
             ~~~~
!!! genericCallWithGenericSignatureArguments2.ts(36,10): error TS2087: Could not select overload for 'call' expression.