=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments.ts ===
// 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) {
>foo : <T>(a: (x: T) => T, b: (x: T) => T) => (x: T) => T
>T : T
>a : (x: T) => T
>x : T
>T : T
>T : T
>b : (x: T) => T
>x : T
>T : T
>T : T

    var r: (x: T) => T;
>r : (x: T) => T
>x : T
>T : T
>T : T

    return r;
>r : (x: T) => T
}

//var r1 = foo((x: number) => 1, (x: string) => ''); // error
var r1b = foo((x) => 1, (x) => ''); // {} => {}
>r1b : (x: {}) => {}
>foo((x) => 1, (x) => '') : (x: {}) => {}
>foo : <T>(a: (x: T) => T, b: (x: T) => T) => (x: T) => T
>(x) => 1 : (x: {}) => number
>x : {}
>(x) => '' : (x: {}) => string
>x : {}

var r2 = foo((x: Object) => null, (x: string) => ''); // Object => Object
>r2 : (x: any) => any
>foo((x: Object) => null, (x: string) => '') : (x: any) => any
>foo : <T>(a: (x: T) => T, b: (x: T) => T) => (x: T) => T
>(x: Object) => null : (x: Object) => any
>x : Object
>Object : Object
>(x: string) => '' : (x: string) => string
>x : string

var r3 = foo((x: number) => 1, (x: Object) => null); // number => number
>r3 : (x: any) => any
>foo((x: number) => 1, (x: Object) => null) : (x: any) => any
>foo : <T>(a: (x: T) => T, b: (x: T) => T) => (x: T) => T
>(x: number) => 1 : (x: number) => number
>x : number
>(x: Object) => null : (x: Object) => any
>x : Object
>Object : Object

var r3ii = foo((x: number) => 1, (x: number) => 1); // number => number
>r3ii : (x: number) => number
>foo((x: number) => 1, (x: number) => 1) : (x: number) => number
>foo : <T>(a: (x: T) => T, b: (x: T) => T) => (x: T) => T
>(x: number) => 1 : (x: number) => number
>x : number
>(x: number) => 1 : (x: number) => number
>x : number

var a: { x: number; y?: number; };
>a : { x: number; y?: number; }
>x : number
>y : number

var b: { x: number; z?: number; };
>b : { x: number; z?: number; }
>x : number
>z : number

var r4 = foo((x: typeof a) => a, (x: typeof b) => b); // typeof a => typeof a
>r4 : (x: { x: number; y?: number; }) => { x: number; y?: number; }
>foo((x: typeof a) => a, (x: typeof b) => b) : (x: { x: number; y?: number; }) => { x: number; y?: number; }
>foo : <T>(a: (x: T) => T, b: (x: T) => T) => (x: T) => T
>(x: typeof a) => a : (x: { x: number; y?: number; }) => { x: number; y?: number; }
>x : { x: number; y?: number; }
>a : { x: number; y?: number; }
>a : { x: number; y?: number; }
>(x: typeof b) => b : (x: { x: number; z?: number; }) => { x: number; z?: number; }
>x : { x: number; z?: number; }
>b : { x: number; z?: number; }
>b : { x: number; z?: number; }

var r5 = foo((x: typeof b) => b, (x: typeof a) => a); // typeof b => typeof b
>r5 : (x: { x: number; z?: number; }) => { x: number; z?: number; }
>foo((x: typeof b) => b, (x: typeof a) => a) : (x: { x: number; z?: number; }) => { x: number; z?: number; }
>foo : <T>(a: (x: T) => T, b: (x: T) => T) => (x: T) => T
>(x: typeof b) => b : (x: { x: number; z?: number; }) => { x: number; z?: number; }
>x : { x: number; z?: number; }
>b : { x: number; z?: number; }
>b : { x: number; z?: number; }
>(x: typeof a) => a : (x: { x: number; y?: number; }) => { x: number; y?: number; }
>x : { x: number; y?: number; }
>a : { x: number; y?: number; }
>a : { x: number; y?: number; }

function other<T>(x: T) {
>other : <T>(x: T) => void
>T : T
>x : T
>T : T

    var r6 = foo((a: T) => a, (b: T) => b); // T => T
>r6 : (x: T) => T
>foo((a: T) => a, (b: T) => b) : (x: T) => T
>foo : <T>(a: (x: T) => T, b: (x: T) => T) => (x: T) => T
>(a: T) => a : (a: T) => T
>a : T
>T : T
>a : T
>(b: T) => b : (b: T) => T
>b : T
>T : T
>b : T

    var r6b = foo((a) => a, (b) => b); // {} => {}
>r6b : (x: {}) => {}
>foo((a) => a, (b) => b) : (x: {}) => {}
>foo : <T>(a: (x: T) => T, b: (x: T) => T) => (x: T) => T
>(a) => a : (a: {}) => {}
>a : {}
>a : {}
>(b) => b : (b: {}) => {}
>b : {}
>b : {}
}

function other2<T extends Date>(x: T) {
>other2 : <T extends Date>(x: T) => void
>T : T
>Date : Date
>x : T
>T : T

    var r7 = foo((a: T) => a, (b: T) => b); // T => T
>r7 : (x: T) => T
>foo((a: T) => a, (b: T) => b) : (x: T) => T
>foo : <T>(a: (x: T) => T, b: (x: T) => T) => (x: T) => T
>(a: T) => a : (a: T) => T
>a : T
>T : T
>a : T
>(b: T) => b : (b: T) => T
>b : T
>T : T
>b : T

    var r7b = foo((a) => a, (b) => b); // {} => {}
>r7b : (x: {}) => {}
>foo((a) => a, (b) => b) : (x: {}) => {}
>foo : <T>(a: (x: T) => T, b: (x: T) => T) => (x: T) => T
>(a) => a : (a: {}) => {}
>a : {}
>a : {}
>(b) => b : (b: {}) => {}
>b : {}
>b : {}

    var r8 = r7(null);
>r8 : T
>r7(null) : T
>r7 : (x: T) => T

    // BUG 835518
    //var r9 = r7(new Date());
}


function foo2<T extends Date>(a: (x: T) => T, b: (x: T) => T) {
>foo2 : <T extends Date>(a: (x: T) => T, b: (x: T) => T) => (x: T) => T
>T : T
>Date : Date
>a : (x: T) => T
>x : T
>T : T
>T : T
>b : (x: T) => T
>x : T
>T : T
>T : T

    var r: (x: T) => T;
>r : (x: T) => T
>x : T
>T : T
>T : T

    return r;
>r : (x: T) => T
}

function other3<T extends RegExp>(x: T) {
>other3 : <T extends RegExp>(x: T) => void
>T : T
>RegExp : RegExp
>x : T
>T : T

    var r8 = foo2((a: Date) => a, (b: Date) => b); // Date => Date
>r8 : (x: Date) => Date
>foo2((a: Date) => a, (b: Date) => b) : (x: Date) => Date
>foo2 : <T extends Date>(a: (x: T) => T, b: (x: T) => T) => (x: T) => T
>(a: Date) => a : (a: Date) => Date
>a : Date
>Date : Date
>a : Date
>(b: Date) => b : (b: Date) => Date
>b : Date
>Date : Date
>b : Date
}
