113 lines
2.1 KiB
Plaintext
113 lines
2.1 KiB
Plaintext
|
=== tests/cases/conformance/expressions/unaryOperators/voidOperator/voidOperatorWithBooleanType.ts ===
|
||
|
// void operator on boolean type
|
||
|
var BOOLEAN: boolean;
|
||
|
>BOOLEAN : boolean
|
||
|
|
||
|
function foo(): boolean { return true; }
|
||
|
>foo : () => boolean
|
||
|
|
||
|
class A {
|
||
|
>A : A
|
||
|
|
||
|
public a: boolean;
|
||
|
>a : boolean
|
||
|
|
||
|
static foo() { return false; }
|
||
|
>foo : () => boolean
|
||
|
}
|
||
|
module M {
|
||
|
>M : typeof M
|
||
|
|
||
|
export var n: boolean;
|
||
|
>n : boolean
|
||
|
}
|
||
|
|
||
|
var objA = new A();
|
||
|
>objA : A
|
||
|
>new A() : A
|
||
|
>A : typeof A
|
||
|
|
||
|
// boolean type var
|
||
|
var ResultIsAny1 = void BOOLEAN;
|
||
|
>ResultIsAny1 : any
|
||
|
>void BOOLEAN : undefined
|
||
|
>BOOLEAN : boolean
|
||
|
|
||
|
// boolean type literal
|
||
|
var ResultIsAny2 = void true;
|
||
|
>ResultIsAny2 : any
|
||
|
>void true : undefined
|
||
|
|
||
|
var ResultIsAny3 = void { x: true, y: false };
|
||
|
>ResultIsAny3 : any
|
||
|
>void { x: true, y: false } : undefined
|
||
|
>{ x: true, y: false } : { x: boolean; y: boolean; }
|
||
|
>x : boolean
|
||
|
>y : boolean
|
||
|
|
||
|
// boolean type expressions
|
||
|
var ResultIsAny4 = void objA.a;
|
||
|
>ResultIsAny4 : any
|
||
|
>void objA.a : undefined
|
||
|
>objA.a : boolean
|
||
|
>objA : A
|
||
|
>a : boolean
|
||
|
|
||
|
var ResultIsAny5 = void M.n;
|
||
|
>ResultIsAny5 : any
|
||
|
>void M.n : undefined
|
||
|
>M.n : boolean
|
||
|
>M : typeof M
|
||
|
>n : boolean
|
||
|
|
||
|
var ResultIsAny6 = void foo();
|
||
|
>ResultIsAny6 : any
|
||
|
>void foo() : undefined
|
||
|
>foo() : boolean
|
||
|
>foo : () => boolean
|
||
|
|
||
|
var ResultIsAny7 = void A.foo();
|
||
|
>ResultIsAny7 : any
|
||
|
>void A.foo() : undefined
|
||
|
>A.foo() : boolean
|
||
|
>A.foo : () => boolean
|
||
|
>A : typeof A
|
||
|
>foo : () => boolean
|
||
|
|
||
|
// multiple void operator
|
||
|
var ResultIsAny8 = void void BOOLEAN;
|
||
|
>ResultIsAny8 : any
|
||
|
>void void BOOLEAN : undefined
|
||
|
>void BOOLEAN : undefined
|
||
|
>BOOLEAN : boolean
|
||
|
|
||
|
// miss assignment operators
|
||
|
void true;
|
||
|
>void true : undefined
|
||
|
|
||
|
void BOOLEAN;
|
||
|
>void BOOLEAN : undefined
|
||
|
>BOOLEAN : boolean
|
||
|
|
||
|
void foo();
|
||
|
>void foo() : undefined
|
||
|
>foo() : boolean
|
||
|
>foo : () => boolean
|
||
|
|
||
|
void true, false;
|
||
|
>void true, false : boolean
|
||
|
>void true : undefined
|
||
|
|
||
|
void objA.a;
|
||
|
>void objA.a : undefined
|
||
|
>objA.a : boolean
|
||
|
>objA : A
|
||
|
>a : boolean
|
||
|
|
||
|
void M.n;
|
||
|
>void M.n : undefined
|
||
|
>M.n : boolean
|
||
|
>M : typeof M
|
||
|
>n : boolean
|
||
|
|