//// [tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorConditionIsNumberType.ts] ////

//// [conditionalOperatorConditionIsNumberType.ts]
//Cond ? Expr1 : Expr2,  Cond is of number type, Expr1 and Expr2 have the same type
declare var condNumber: number;

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 a number type variable
condNumber ? exprAny1 : exprAny2;
condNumber ? exprBoolean1 : exprBoolean2;
condNumber ? exprNumber1 : exprNumber2;
condNumber ? exprString1 : exprString2;
condNumber ? exprIsObject1 : exprIsObject2;
condNumber ? exprString1 : exprBoolean1; // Union

//Cond is a number type literal
1 ? exprAny1 : exprAny2;
0 ? exprBoolean1 : exprBoolean2;
0.123456789 ? exprNumber1 : exprNumber2;
- 10000000000000 ? exprString1 : exprString2;
1000000000000 ? exprIsObject1 : exprIsObject2;
10000 ? exprString1 : exprBoolean1; // Union

//Cond is a number type expression
function foo() { return 1 };
var array = [1, 2, 3];

1 * 0 ? exprAny1 : exprAny2;
1 + 1 ? exprBoolean1 : exprBoolean2;
"string".length ? exprNumber1 : exprNumber2;
foo() ? exprString1 : exprString2;
foo() / array[1] ? exprIsObject1 : exprIsObject2;
foo() ? exprString1 : exprBoolean1; // Union

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

var resultIsAny2 = 1 ? exprAny1 : exprAny2;
var resultIsBoolean2 = 0 ? exprBoolean1 : exprBoolean2;
var resultIsNumber2 = 0.123456789 ? exprNumber1 : exprNumber2;
var resultIsString2 = - 10000000000000 ? exprString1 : exprString2;
var resultIsObject2 = 1000000000000 ? exprIsObject1 : exprIsObject2;
var resultIsStringOrBoolean2 = 10000 ? exprString1 : exprBoolean1; // Union

var resultIsAny3 = 1 * 0 ? exprAny1 : exprAny2;
var resultIsBoolean3 = 1 + 1 ? exprBoolean1 : exprBoolean2;
var resultIsNumber3 = "string".length ? exprNumber1 : exprNumber2;
var resultIsString3 = foo() ? exprString1 : exprString2;
var resultIsObject3 = foo() / array[1] ? exprIsObject1 : exprIsObject2;
var resultIsStringOrBoolean3 = foo() / array[1] ? exprString1 : exprBoolean1; // Union

//// [conditionalOperatorConditionIsNumberType.js]
"use strict";
//Cond is a number type variable
condNumber ? exprAny1 : exprAny2;
condNumber ? exprBoolean1 : exprBoolean2;
condNumber ? exprNumber1 : exprNumber2;
condNumber ? exprString1 : exprString2;
condNumber ? exprIsObject1 : exprIsObject2;
condNumber ? exprString1 : exprBoolean1; // Union
//Cond is a number type literal
1 ? exprAny1 : exprAny2;
0 ? exprBoolean1 : exprBoolean2;
0.123456789 ? exprNumber1 : exprNumber2;
-10000000000000 ? exprString1 : exprString2;
1000000000000 ? exprIsObject1 : exprIsObject2;
10000 ? exprString1 : exprBoolean1; // Union
//Cond is a number type expression
function foo() { return 1; }
;
var array = [1, 2, 3];
1 * 0 ? exprAny1 : exprAny2;
1 + 1 ? exprBoolean1 : exprBoolean2;
"string".length ? exprNumber1 : exprNumber2;
foo() ? exprString1 : exprString2;
foo() / array[1] ? exprIsObject1 : exprIsObject2;
foo() ? exprString1 : exprBoolean1; // Union
//Results shoud be same as Expr1 and Expr2
var resultIsAny1 = condNumber ? exprAny1 : exprAny2;
var resultIsBoolean1 = condNumber ? exprBoolean1 : exprBoolean2;
var resultIsNumber1 = condNumber ? exprNumber1 : exprNumber2;
var resultIsString1 = condNumber ? exprString1 : exprString2;
var resultIsObject1 = condNumber ? exprIsObject1 : exprIsObject2;
var resultIsStringOrBoolean1 = condNumber ? exprString1 : exprBoolean1; // Union
var resultIsAny2 = 1 ? exprAny1 : exprAny2;
var resultIsBoolean2 = 0 ? exprBoolean1 : exprBoolean2;
var resultIsNumber2 = 0.123456789 ? exprNumber1 : exprNumber2;
var resultIsString2 = -10000000000000 ? exprString1 : exprString2;
var resultIsObject2 = 1000000000000 ? exprIsObject1 : exprIsObject2;
var resultIsStringOrBoolean2 = 10000 ? exprString1 : exprBoolean1; // Union
var resultIsAny3 = 1 * 0 ? exprAny1 : exprAny2;
var resultIsBoolean3 = 1 + 1 ? exprBoolean1 : exprBoolean2;
var resultIsNumber3 = "string".length ? exprNumber1 : exprNumber2;
var resultIsString3 = foo() ? exprString1 : exprString2;
var resultIsObject3 = foo() / array[1] ? exprIsObject1 : exprIsObject2;
var resultIsStringOrBoolean3 = foo() / array[1] ? exprString1 : exprBoolean1; // Union
