166 lines
3.5 KiB
Plaintext
166 lines
3.5 KiB
Plaintext
|
=== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts ===
|
||
|
// delete operator on number type
|
||
|
var NUMBER: number;
|
||
|
>NUMBER : number
|
||
|
|
||
|
var NUMBER1: number[] = [1, 2];
|
||
|
>NUMBER1 : number[]
|
||
|
>[1, 2] : number[]
|
||
|
|
||
|
function foo(): number { return 1; }
|
||
|
>foo : () => number
|
||
|
|
||
|
class A {
|
||
|
>A : A
|
||
|
|
||
|
public a: number;
|
||
|
>a : number
|
||
|
|
||
|
static foo() { return 1; }
|
||
|
>foo : () => 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 ResultIsBoolean1 = delete NUMBER;
|
||
|
>ResultIsBoolean1 : boolean
|
||
|
>delete NUMBER : boolean
|
||
|
>NUMBER : number
|
||
|
|
||
|
var ResultIsBoolean2 = delete NUMBER1;
|
||
|
>ResultIsBoolean2 : boolean
|
||
|
>delete NUMBER1 : boolean
|
||
|
>NUMBER1 : number[]
|
||
|
|
||
|
// number type literal
|
||
|
var ResultIsBoolean3 = delete 1;
|
||
|
>ResultIsBoolean3 : boolean
|
||
|
>delete 1 : boolean
|
||
|
|
||
|
var ResultIsBoolean4 = delete { x: 1, y: 2};
|
||
|
>ResultIsBoolean4 : boolean
|
||
|
>delete { x: 1, y: 2} : boolean
|
||
|
>{ x: 1, y: 2} : { x: number; y: number; }
|
||
|
>x : number
|
||
|
>y : number
|
||
|
|
||
|
var ResultIsBoolean5 = delete { x: 1, y: (n: number) => { return n; } };
|
||
|
>ResultIsBoolean5 : boolean
|
||
|
>delete { x: 1, y: (n: number) => { return n; } } : boolean
|
||
|
>{ x: 1, y: (n: number) => { return n; } } : { x: number; y: (n: number) => number; }
|
||
|
>x : number
|
||
|
>y : (n: number) => number
|
||
|
>(n: number) => { return n; } : (n: number) => number
|
||
|
>n : number
|
||
|
>n : number
|
||
|
|
||
|
// number type expressions
|
||
|
var ResultIsBoolean6 = delete objA.a;
|
||
|
>ResultIsBoolean6 : boolean
|
||
|
>delete objA.a : boolean
|
||
|
>objA.a : number
|
||
|
>objA : A
|
||
|
>a : number
|
||
|
|
||
|
var ResultIsBoolean7 = delete M.n;
|
||
|
>ResultIsBoolean7 : boolean
|
||
|
>delete M.n : boolean
|
||
|
>M.n : number
|
||
|
>M : typeof M
|
||
|
>n : number
|
||
|
|
||
|
var ResultIsBoolean8 = delete NUMBER1[0];
|
||
|
>ResultIsBoolean8 : boolean
|
||
|
>delete NUMBER1[0] : boolean
|
||
|
>NUMBER1[0] : number
|
||
|
>NUMBER1 : number[]
|
||
|
|
||
|
var ResultIsBoolean9 = delete foo();
|
||
|
>ResultIsBoolean9 : boolean
|
||
|
>delete foo() : boolean
|
||
|
>foo() : number
|
||
|
>foo : () => number
|
||
|
|
||
|
var ResultIsBoolean10 = delete A.foo();
|
||
|
>ResultIsBoolean10 : boolean
|
||
|
>delete A.foo() : boolean
|
||
|
>A.foo() : number
|
||
|
>A.foo : () => number
|
||
|
>A : typeof A
|
||
|
>foo : () => number
|
||
|
|
||
|
var ResultIsBoolean11 = delete (NUMBER + NUMBER);
|
||
|
>ResultIsBoolean11 : boolean
|
||
|
>delete (NUMBER + NUMBER) : boolean
|
||
|
>(NUMBER + NUMBER) : number
|
||
|
>NUMBER + NUMBER : number
|
||
|
>NUMBER : number
|
||
|
>NUMBER : number
|
||
|
|
||
|
// multiple delete operator
|
||
|
var ResultIsBoolean12 = delete delete NUMBER;
|
||
|
>ResultIsBoolean12 : boolean
|
||
|
>delete delete NUMBER : boolean
|
||
|
>delete NUMBER : boolean
|
||
|
>NUMBER : number
|
||
|
|
||
|
var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER);
|
||
|
>ResultIsBoolean13 : boolean
|
||
|
>delete delete delete (NUMBER + NUMBER) : boolean
|
||
|
>delete delete (NUMBER + NUMBER) : boolean
|
||
|
>delete (NUMBER + NUMBER) : boolean
|
||
|
>(NUMBER + NUMBER) : number
|
||
|
>NUMBER + NUMBER : number
|
||
|
>NUMBER : number
|
||
|
>NUMBER : number
|
||
|
|
||
|
// miss assignment operators
|
||
|
delete 1;
|
||
|
>delete 1 : boolean
|
||
|
|
||
|
delete NUMBER;
|
||
|
>delete NUMBER : boolean
|
||
|
>NUMBER : number
|
||
|
|
||
|
delete NUMBER1;
|
||
|
>delete NUMBER1 : boolean
|
||
|
>NUMBER1 : number[]
|
||
|
|
||
|
delete foo();
|
||
|
>delete foo() : boolean
|
||
|
>foo() : number
|
||
|
>foo : () => number
|
||
|
|
||
|
delete objA.a;
|
||
|
>delete objA.a : boolean
|
||
|
>objA.a : number
|
||
|
>objA : A
|
||
|
>a : number
|
||
|
|
||
|
delete M.n;
|
||
|
>delete M.n : boolean
|
||
|
>M.n : number
|
||
|
>M : typeof M
|
||
|
>n : number
|
||
|
|
||
|
delete objA.a, M.n;
|
||
|
>delete objA.a, M.n : number
|
||
|
>delete objA.a : boolean
|
||
|
>objA.a : number
|
||
|
>objA : A
|
||
|
>a : number
|
||
|
>M.n : number
|
||
|
>M : typeof M
|
||
|
>n : number
|
||
|
|