// @target: es2015
//Cond ? Expr1 : Expr2,  Cond is of any type, Expr1 and Expr2 have the same type
declare var condAny: any;
declare var x: any;

declare var exprAny1: any;
declare var exprBoolean1: boolean;
declare var exprNumber1: number;
declare var exprString1: string;
declare var exprIsObject1: Object;

declare var exprAny2: any;
declare var exprBoolean2: boolean;
declare var exprNumber2: number;
declare var exprString2: string;
declare var exprIsObject2: Object;

//Cond is an any type variable
condAny ? exprAny1 : exprAny2;
condAny ? exprBoolean1 : exprBoolean2;
condAny ? exprNumber1 : exprNumber2;
condAny ? exprString1 : exprString2;
condAny ? exprIsObject1 : exprIsObject2;
condAny ? exprString1 : exprBoolean1; // union

//Cond is an any type literal
null ? exprAny1 : exprAny2;
null ? exprBoolean1 : exprBoolean2;
undefined ? exprNumber1 : exprNumber2;
[null, undefined] ? exprString1 : exprString2;
[null, undefined] ? exprIsObject1 : exprIsObject2;
undefined ? exprString1 : exprBoolean1; // union

//Cond is an any type expression
x.doSomeThing() ? exprAny1 : exprAny2;
x("x") ? exprBoolean1 : exprBoolean2;
x(x) ? exprNumber1 : exprNumber2;
x("x") ? exprString1 : exprString2;
x.doSomeThing() ? exprIsObject1 : exprIsObject2;
x.doSomeThing() ? exprString1 : exprBoolean1; // union

//Results shoud be same as Expr1 and Expr2
var resultIsAny1 = condAny ? exprAny1 : exprAny2;
var resultIsBoolean1 = condAny ? exprBoolean1 : exprBoolean2;
var resultIsNumber1 = condAny ? exprNumber1 : exprNumber2;
var resultIsString1 = condAny ? exprString1 : exprString2;
var resultIsObject1 = condAny ? exprIsObject1 : exprIsObject2;
var resultIsStringOrBoolean1 = condAny ? exprString1 : exprBoolean1; // union

var resultIsAny2 = null ? exprAny1 : exprAny2;
var resultIsBoolean2 = null ? exprBoolean1 : exprBoolean2;
var resultIsNumber2 = undefined ? exprNumber1 : exprNumber2;
var resultIsString2 = [null, undefined] ? exprString1 : exprString2;
var resultIsObject2 = [null, undefined] ? exprIsObject1 : exprIsObject2;
var resultIsStringOrBoolean2 = null ? exprString1 : exprBoolean1; // union
var resultIsStringOrBoolean3 = undefined ? exprString1 : exprBoolean1; // union
var resultIsStringOrBoolean4 = [null, undefined] ? exprString1 : exprBoolean1; // union

var resultIsAny3 = x.doSomeThing() ? exprAny1 : exprAny2;
var resultIsBoolean3 = x("x") ? exprBoolean1 : exprBoolean2;
var resultIsNumber3 = x(x) ? exprNumber1 : exprNumber2;
var resultIsString3 = x("x") ? exprString1 : exprString2;
var resultIsObject3 = x.doSomeThing() ? exprIsObject1 : exprIsObject2;
var resultIsStringOrBoolean5 = x.doSomeThing() ? exprString1 : exprBoolean1; // union