175 lines
3.4 KiB
Text
175 lines
3.4 KiB
Text
=== tests/cases/conformance/expressions/unaryOperators/voidOperator/voidOperatorWithNumberType.ts ===
|
|
// void operator on number type
|
|
var NUMBER: number;
|
|
>NUMBER : number
|
|
|
|
var NUMBER1: number[] = [1, 2];
|
|
>NUMBER1 : number[]
|
|
>[1, 2] : number[]
|
|
>1 : number
|
|
>2 : number
|
|
|
|
function foo(): number { return 1; }
|
|
>foo : () => number
|
|
>1 : number
|
|
|
|
class A {
|
|
>A : A
|
|
|
|
public a: number;
|
|
>a : number
|
|
|
|
static foo() { return 1; }
|
|
>foo : () => number
|
|
>1 : number
|
|
}
|
|
module M {
|
|
>M : typeof M
|
|
|
|
export var n: number;
|
|
>n : number
|
|
}
|
|
|
|
var objA = new A();
|
|
>objA : A
|
|
>new A() : A
|
|
>A : typeof A
|
|
|
|
// number type var
|
|
var ResultIsAny1 = void NUMBER;
|
|
>ResultIsAny1 : any
|
|
>void NUMBER : undefined
|
|
>NUMBER : number
|
|
|
|
var ResultIsAny2 = void NUMBER1;
|
|
>ResultIsAny2 : any
|
|
>void NUMBER1 : undefined
|
|
>NUMBER1 : number[]
|
|
|
|
// number type literal
|
|
var ResultIsAny3 = void 1;
|
|
>ResultIsAny3 : any
|
|
>void 1 : undefined
|
|
>1 : number
|
|
|
|
var ResultIsAny4 = void { x: 1, y: 2};
|
|
>ResultIsAny4 : any
|
|
>void { x: 1, y: 2} : undefined
|
|
>{ x: 1, y: 2} : { x: number; y: number; }
|
|
>x : number
|
|
>1 : number
|
|
>y : number
|
|
>2 : number
|
|
|
|
var ResultIsAny5 = void { x: 1, y: (n: number) => { return n; } };
|
|
>ResultIsAny5 : any
|
|
>void { x: 1, y: (n: number) => { return n; } } : undefined
|
|
>{ x: 1, y: (n: number) => { return n; } } : { x: number; y: (n: number) => number; }
|
|
>x : number
|
|
>1 : number
|
|
>y : (n: number) => number
|
|
>(n: number) => { return n; } : (n: number) => number
|
|
>n : number
|
|
>n : number
|
|
|
|
// number type expressions
|
|
var ResultIsAny6 = void objA.a;
|
|
>ResultIsAny6 : any
|
|
>void objA.a : undefined
|
|
>objA.a : number
|
|
>objA : A
|
|
>a : number
|
|
|
|
var ResultIsAny7 = void M.n;
|
|
>ResultIsAny7 : any
|
|
>void M.n : undefined
|
|
>M.n : number
|
|
>M : typeof M
|
|
>n : number
|
|
|
|
var ResultIsAny8 = void NUMBER1[0];
|
|
>ResultIsAny8 : any
|
|
>void NUMBER1[0] : undefined
|
|
>NUMBER1[0] : number
|
|
>NUMBER1 : number[]
|
|
>0 : number
|
|
|
|
var ResultIsAny9 = void foo();
|
|
>ResultIsAny9 : any
|
|
>void foo() : undefined
|
|
>foo() : number
|
|
>foo : () => number
|
|
|
|
var ResultIsAny10 = void A.foo();
|
|
>ResultIsAny10 : any
|
|
>void A.foo() : undefined
|
|
>A.foo() : number
|
|
>A.foo : () => number
|
|
>A : typeof A
|
|
>foo : () => number
|
|
|
|
var ResultIsAny11 = void (NUMBER + NUMBER);
|
|
>ResultIsAny11 : any
|
|
>void (NUMBER + NUMBER) : undefined
|
|
>(NUMBER + NUMBER) : number
|
|
>NUMBER + NUMBER : number
|
|
>NUMBER : number
|
|
>NUMBER : number
|
|
|
|
// multiple void operators
|
|
var ResultIsAny12 = void void NUMBER;
|
|
>ResultIsAny12 : any
|
|
>void void NUMBER : undefined
|
|
>void NUMBER : undefined
|
|
>NUMBER : number
|
|
|
|
var ResultIsAny13 = void void void (NUMBER + NUMBER);
|
|
>ResultIsAny13 : any
|
|
>void void void (NUMBER + NUMBER) : undefined
|
|
>void void (NUMBER + NUMBER) : undefined
|
|
>void (NUMBER + NUMBER) : undefined
|
|
>(NUMBER + NUMBER) : number
|
|
>NUMBER + NUMBER : number
|
|
>NUMBER : number
|
|
>NUMBER : number
|
|
|
|
// miss assignment operators
|
|
void 1;
|
|
>void 1 : undefined
|
|
>1 : number
|
|
|
|
void NUMBER;
|
|
>void NUMBER : undefined
|
|
>NUMBER : number
|
|
|
|
void NUMBER1;
|
|
>void NUMBER1 : undefined
|
|
>NUMBER1 : number[]
|
|
|
|
void foo();
|
|
>void foo() : undefined
|
|
>foo() : number
|
|
>foo : () => number
|
|
|
|
void objA.a;
|
|
>void objA.a : undefined
|
|
>objA.a : number
|
|
>objA : A
|
|
>a : number
|
|
|
|
void M.n;
|
|
>void M.n : undefined
|
|
>M.n : number
|
|
>M : typeof M
|
|
>n : number
|
|
|
|
void objA.a, M.n;
|
|
>void objA.a, M.n : number
|
|
>void objA.a : undefined
|
|
>objA.a : number
|
|
>objA : A
|
|
>a : number
|
|
>M.n : number
|
|
>M : typeof M
|
|
>n : number
|
|
|