107 lines
4.9 KiB
Text
107 lines
4.9 KiB
Text
=== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator.ts ===
|
|
// If one operand is the null or undefined value, it is treated as having the type of the other operand.
|
|
|
|
enum E { a, b, c }
|
|
>E : Symbol(E, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 0, 0))
|
|
>a : Symbol(E.a, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 2, 8))
|
|
>b : Symbol(E.b, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 2, 11))
|
|
>c : Symbol(E.c, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 2, 14))
|
|
|
|
var a: any;
|
|
>a : Symbol(a, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 4, 3))
|
|
|
|
var b: number;
|
|
>b : Symbol(b, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 5, 3))
|
|
|
|
var c: E;
|
|
>c : Symbol(c, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 6, 3))
|
|
>E : Symbol(E, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 0, 0))
|
|
|
|
var d: string;
|
|
>d : Symbol(d, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 7, 3))
|
|
|
|
// undefined + any
|
|
var r1: any = undefined + a;
|
|
>r1 : Symbol(r1, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 10, 3))
|
|
>undefined : Symbol(undefined)
|
|
>a : Symbol(a, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 4, 3))
|
|
|
|
var r2: any = a + undefined;
|
|
>r2 : Symbol(r2, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 11, 3))
|
|
>a : Symbol(a, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 4, 3))
|
|
>undefined : Symbol(undefined)
|
|
|
|
// undefined + number/enum
|
|
var r3 = undefined + b;
|
|
>r3 : Symbol(r3, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 14, 3))
|
|
>undefined : Symbol(undefined)
|
|
>b : Symbol(b, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 5, 3))
|
|
|
|
var r4 = undefined + 1;
|
|
>r4 : Symbol(r4, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 15, 3))
|
|
>undefined : Symbol(undefined)
|
|
|
|
var r5 = undefined + c;
|
|
>r5 : Symbol(r5, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 16, 3))
|
|
>undefined : Symbol(undefined)
|
|
>c : Symbol(c, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 6, 3))
|
|
|
|
var r6 = undefined + E.a;
|
|
>r6 : Symbol(r6, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 17, 3))
|
|
>undefined : Symbol(undefined)
|
|
>E.a : Symbol(E.a, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 2, 8))
|
|
>E : Symbol(E, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 0, 0))
|
|
>a : Symbol(E.a, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 2, 8))
|
|
|
|
var r7 = undefined + E['a'];
|
|
>r7 : Symbol(r7, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 18, 3))
|
|
>undefined : Symbol(undefined)
|
|
>E : Symbol(E, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 0, 0))
|
|
>'a' : Symbol(E.a, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 2, 8))
|
|
|
|
var r8 = b + undefined;
|
|
>r8 : Symbol(r8, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 19, 3))
|
|
>b : Symbol(b, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 5, 3))
|
|
>undefined : Symbol(undefined)
|
|
|
|
var r9 = 1 + undefined;
|
|
>r9 : Symbol(r9, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 20, 3))
|
|
>undefined : Symbol(undefined)
|
|
|
|
var r10 = c + undefined
|
|
>r10 : Symbol(r10, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 21, 3))
|
|
>c : Symbol(c, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 6, 3))
|
|
>undefined : Symbol(undefined)
|
|
|
|
var r11 = E.a + undefined;
|
|
>r11 : Symbol(r11, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 22, 3))
|
|
>E.a : Symbol(E.a, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 2, 8))
|
|
>E : Symbol(E, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 0, 0))
|
|
>a : Symbol(E.a, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 2, 8))
|
|
>undefined : Symbol(undefined)
|
|
|
|
var r12 = E['a'] + undefined;
|
|
>r12 : Symbol(r12, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 23, 3))
|
|
>E : Symbol(E, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 0, 0))
|
|
>'a' : Symbol(E.a, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 2, 8))
|
|
>undefined : Symbol(undefined)
|
|
|
|
// undefined + string
|
|
var r13 = undefined + d;
|
|
>r13 : Symbol(r13, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 26, 3))
|
|
>undefined : Symbol(undefined)
|
|
>d : Symbol(d, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 7, 3))
|
|
|
|
var r14 = undefined + '';
|
|
>r14 : Symbol(r14, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 27, 3))
|
|
>undefined : Symbol(undefined)
|
|
|
|
var r15 = d + undefined;
|
|
>r15 : Symbol(r15, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 28, 3))
|
|
>d : Symbol(d, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 7, 3))
|
|
>undefined : Symbol(undefined)
|
|
|
|
var r16 = '' + undefined;
|
|
>r16 : Symbol(r16, Decl(additionOperatorWithUndefinedValueAndValidOperator.ts, 29, 3))
|
|
>undefined : Symbol(undefined)
|
|
|