120 lines
2.3 KiB
Text
120 lines
2.3 KiB
Text
=== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts ===
|
|
// delete operator on boolean type
|
|
var BOOLEAN: boolean;
|
|
>BOOLEAN : boolean
|
|
|
|
function foo(): boolean { return true; }
|
|
>foo : () => boolean
|
|
>true : boolean
|
|
|
|
class A {
|
|
>A : A
|
|
|
|
public a: boolean;
|
|
>a : boolean
|
|
|
|
static foo() { return false; }
|
|
>foo : () => boolean
|
|
>false : 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 ResultIsBoolean1 = delete BOOLEAN;
|
|
>ResultIsBoolean1 : boolean
|
|
>delete BOOLEAN : boolean
|
|
>BOOLEAN : boolean
|
|
|
|
// boolean type literal
|
|
var ResultIsBoolean2 = delete true;
|
|
>ResultIsBoolean2 : boolean
|
|
>delete true : boolean
|
|
>true : boolean
|
|
|
|
var ResultIsBoolean3 = delete { x: true, y: false };
|
|
>ResultIsBoolean3 : boolean
|
|
>delete { x: true, y: false } : boolean
|
|
>{ x: true, y: false } : { x: boolean; y: boolean; }
|
|
>x : boolean
|
|
>true : boolean
|
|
>y : boolean
|
|
>false : boolean
|
|
|
|
// boolean type expressions
|
|
var ResultIsBoolean4 = delete objA.a;
|
|
>ResultIsBoolean4 : boolean
|
|
>delete objA.a : boolean
|
|
>objA.a : boolean
|
|
>objA : A
|
|
>a : boolean
|
|
|
|
var ResultIsBoolean5 = delete M.n;
|
|
>ResultIsBoolean5 : boolean
|
|
>delete M.n : boolean
|
|
>M.n : boolean
|
|
>M : typeof M
|
|
>n : boolean
|
|
|
|
var ResultIsBoolean6 = delete foo();
|
|
>ResultIsBoolean6 : boolean
|
|
>delete foo() : boolean
|
|
>foo() : boolean
|
|
>foo : () => boolean
|
|
|
|
var ResultIsBoolean7 = delete A.foo();
|
|
>ResultIsBoolean7 : boolean
|
|
>delete A.foo() : boolean
|
|
>A.foo() : boolean
|
|
>A.foo : () => boolean
|
|
>A : typeof A
|
|
>foo : () => boolean
|
|
|
|
// multiple delete operator
|
|
var ResultIsBoolean8 = delete delete BOOLEAN;
|
|
>ResultIsBoolean8 : boolean
|
|
>delete delete BOOLEAN : boolean
|
|
>delete BOOLEAN : boolean
|
|
>BOOLEAN : boolean
|
|
|
|
// miss assignment operators
|
|
delete true;
|
|
>delete true : boolean
|
|
>true : boolean
|
|
|
|
delete BOOLEAN;
|
|
>delete BOOLEAN : boolean
|
|
>BOOLEAN : boolean
|
|
|
|
delete foo();
|
|
>delete foo() : boolean
|
|
>foo() : boolean
|
|
>foo : () => boolean
|
|
|
|
delete true, false;
|
|
>delete true, false : boolean
|
|
>delete true : boolean
|
|
>true : boolean
|
|
>false : boolean
|
|
|
|
delete objA.a;
|
|
>delete objA.a : boolean
|
|
>objA.a : boolean
|
|
>objA : A
|
|
>a : boolean
|
|
|
|
delete M.n;
|
|
>delete M.n : boolean
|
|
>M.n : boolean
|
|
>M : typeof M
|
|
>n : boolean
|
|
|