171 lines
2.4 KiB
Text
171 lines
2.4 KiB
Text
=== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithAnyAndEveryType.ts ===
|
|
function foo() { }
|
|
>foo : () => void
|
|
|
|
class C {
|
|
>C : C
|
|
|
|
public a: string;
|
|
>a : string
|
|
|
|
static foo() { }
|
|
>foo : () => void
|
|
}
|
|
enum E { a, b, c }
|
|
>E : E
|
|
>a : E
|
|
>b : E
|
|
>c : E
|
|
|
|
module M { export var a }
|
|
>M : typeof M
|
|
>a : any
|
|
|
|
var a: any;
|
|
>a : any
|
|
|
|
var b: boolean;
|
|
>b : boolean
|
|
|
|
var c: number;
|
|
>c : number
|
|
|
|
var d: string;
|
|
>d : string
|
|
|
|
var e: Object;
|
|
>e : Object
|
|
>Object : Object
|
|
|
|
// any as left operand, result is type Any except plusing string
|
|
var r1 = a + a;
|
|
>r1 : any
|
|
>a + a : any
|
|
>a : any
|
|
>a : any
|
|
|
|
var r2 = a + b;
|
|
>r2 : any
|
|
>a + b : any
|
|
>a : any
|
|
>b : boolean
|
|
|
|
var r3 = a + c;
|
|
>r3 : any
|
|
>a + c : any
|
|
>a : any
|
|
>c : number
|
|
|
|
var r4 = a + d;
|
|
>r4 : string
|
|
>a + d : string
|
|
>a : any
|
|
>d : string
|
|
|
|
var r5 = a + e;
|
|
>r5 : any
|
|
>a + e : any
|
|
>a : any
|
|
>e : Object
|
|
|
|
// any as right operand, result is type Any except plusing string
|
|
var r6 = b + a;
|
|
>r6 : any
|
|
>b + a : any
|
|
>b : boolean
|
|
>a : any
|
|
|
|
var r7 = c + a;
|
|
>r7 : any
|
|
>c + a : any
|
|
>c : number
|
|
>a : any
|
|
|
|
var r8 = d + a;
|
|
>r8 : string
|
|
>d + a : string
|
|
>d : string
|
|
>a : any
|
|
|
|
var r9 = e + a;
|
|
>r9 : any
|
|
>e + a : any
|
|
>e : Object
|
|
>a : any
|
|
|
|
// other cases
|
|
var r10 = a + foo;
|
|
>r10 : any
|
|
>a + foo : any
|
|
>a : any
|
|
>foo : () => void
|
|
|
|
var r11 = a + foo();
|
|
>r11 : any
|
|
>a + foo() : any
|
|
>a : any
|
|
>foo() : void
|
|
>foo : () => void
|
|
|
|
var r12 = a + C;
|
|
>r12 : any
|
|
>a + C : any
|
|
>a : any
|
|
>C : typeof C
|
|
|
|
var r13 = a + new C();
|
|
>r13 : any
|
|
>a + new C() : any
|
|
>a : any
|
|
>new C() : C
|
|
>C : typeof C
|
|
|
|
var r14 = a + E;
|
|
>r14 : any
|
|
>a + E : any
|
|
>a : any
|
|
>E : typeof E
|
|
|
|
var r15 = a + E.a;
|
|
>r15 : any
|
|
>a + E.a : any
|
|
>a : any
|
|
>E.a : E
|
|
>E : typeof E
|
|
>a : E
|
|
|
|
var r16 = a + M;
|
|
>r16 : any
|
|
>a + M : any
|
|
>a : any
|
|
>M : typeof M
|
|
|
|
var r17 = a + '';
|
|
>r17 : string
|
|
>a + '' : string
|
|
>a : any
|
|
>'' : string
|
|
|
|
var r18 = a + 123;
|
|
>r18 : any
|
|
>a + 123 : any
|
|
>a : any
|
|
>123 : number
|
|
|
|
var r19 = a + { a: '' };
|
|
>r19 : any
|
|
>a + { a: '' } : any
|
|
>a : any
|
|
>{ a: '' } : { a: string; }
|
|
>a : string
|
|
>'' : string
|
|
|
|
var r20 = a + ((a: string) => { return a });
|
|
>r20 : any
|
|
>a + ((a: string) => { return a }) : any
|
|
>a : any
|
|
>((a: string) => { return a }) : (a: string) => string
|
|
>(a: string) => { return a } : (a: string) => string
|
|
>a : string
|
|
>a : string
|
|
|