=== tests/cases/conformance/types/typeRelationships/typeInference/unionTypeInference.ts ===
// Verify that inferences made *to* a type parameter in a union type are secondary
// to inferences made directly to that type parameter

function f<T>(x: T, y: string|T): T {
>f : <T>(x: T, y: string | T) => T
>T : T
>x : T
>T : T
>y : string | T
>T : T
>T : T

    return x;
>x : T
}

var a1: number;
>a1 : number

var a1 = f(1, 2);
>a1 : number
>f(1, 2) : number
>f : <T>(x: T, y: string | T) => T

var a2: number;
>a2 : number

var a2 = f(1, "hello");
>a2 : number
>f(1, "hello") : number
>f : <T>(x: T, y: string | T) => T

var a3: number;
>a3 : number

var a3 = f(1, a1 || "hello");
>a3 : number
>f(1, a1 || "hello") : number
>f : <T>(x: T, y: string | T) => T
>a1 || "hello" : string | number
>a1 : number

var a4: any;
>a4 : any

var a4 = f(undefined, "abc");
>a4 : any
>f(undefined, "abc") : any
>f : <T>(x: T, y: string | T) => T
>undefined : undefined

function g<T>(value: [string, T]): T {
>g : <T>(value: [string, T]) => T
>T : T
>value : [string, T]
>T : T
>T : T

    return value[1];
>value[1] : T
>value : [string, T]
}

var b1: boolean;
>b1 : boolean

var b1 = g(["string", true]);
>b1 : boolean
>g(["string", true]) : boolean
>g : <T>(value: [string, T]) => T
>["string", true] : [string, boolean]

function h<T>(x: string|boolean|T): T {
>h : <T>(x: string | boolean | T) => T
>T : T
>x : string | boolean | T
>T : T
>T : T

    return typeof x === "string" || typeof x === "boolean" ? undefined : x;
>typeof x === "string" || typeof x === "boolean" ? undefined : x : T
>typeof x === "string" || typeof x === "boolean" : boolean
>typeof x === "string" : boolean
>typeof x : string
>x : string | boolean | T
>typeof x === "boolean" : boolean
>typeof x : string
>x : boolean | T
>undefined : undefined
>x : T
}

var c1: number;
>c1 : number

var c1 = h(5);
>c1 : number
>h(5) : number
>h : <T>(x: string | boolean | T) => T

var c2: string;
>c2 : string

var c2 = h("abc");
>c2 : string
>h("abc") : string
>h : <T>(x: string | boolean | T) => T

