TypeScript/tests/baselines/reference/deleteOperatorWithStringType.types

172 lines
7.2 KiB
Text

=== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts ===
// delete operator on string type
var STRING: string;
>STRING : string, Symbol(STRING,Decl(deleteOperatorWithStringType.ts,1,3))
var STRING1: string[] = ["", "abc"];
>STRING1 : string[], Symbol(STRING1,Decl(deleteOperatorWithStringType.ts,2,3))
>["", "abc"] : string[]
>"" : string
>"abc" : string
function foo(): string { return "abc"; }
>foo : () => string, Symbol(foo,Decl(deleteOperatorWithStringType.ts,2,36))
>"abc" : string
class A {
>A : A, Symbol(A,Decl(deleteOperatorWithStringType.ts,4,40))
public a: string;
>a : string, Symbol(a,Decl(deleteOperatorWithStringType.ts,6,9))
static foo() { return ""; }
>foo : () => string, Symbol(A.foo,Decl(deleteOperatorWithStringType.ts,7,21))
>"" : string
}
module M {
>M : typeof M, Symbol(M,Decl(deleteOperatorWithStringType.ts,9,1))
export var n: string;
>n : string, Symbol(n,Decl(deleteOperatorWithStringType.ts,11,14))
}
var objA = new A();
>objA : A, Symbol(objA,Decl(deleteOperatorWithStringType.ts,14,3))
>new A() : A
>A : typeof A, Symbol(A,Decl(deleteOperatorWithStringType.ts,4,40))
// string type var
var ResultIsBoolean1 = delete STRING;
>ResultIsBoolean1 : boolean, Symbol(ResultIsBoolean1,Decl(deleteOperatorWithStringType.ts,17,3))
>delete STRING : boolean
>STRING : string, Symbol(STRING,Decl(deleteOperatorWithStringType.ts,1,3))
var ResultIsBoolean2 = delete STRING1;
>ResultIsBoolean2 : boolean, Symbol(ResultIsBoolean2,Decl(deleteOperatorWithStringType.ts,18,3))
>delete STRING1 : boolean
>STRING1 : string[], Symbol(STRING1,Decl(deleteOperatorWithStringType.ts,2,3))
// string type literal
var ResultIsBoolean3 = delete "";
>ResultIsBoolean3 : boolean, Symbol(ResultIsBoolean3,Decl(deleteOperatorWithStringType.ts,21,3))
>delete "" : boolean
>"" : string
var ResultIsBoolean4 = delete { x: "", y: "" };
>ResultIsBoolean4 : boolean, Symbol(ResultIsBoolean4,Decl(deleteOperatorWithStringType.ts,22,3))
>delete { x: "", y: "" } : boolean
>{ x: "", y: "" } : { x: string; y: string; }
>x : string, Symbol(x,Decl(deleteOperatorWithStringType.ts,22,31))
>"" : string
>y : string, Symbol(y,Decl(deleteOperatorWithStringType.ts,22,38))
>"" : string
var ResultIsBoolean5 = delete { x: "", y: (s: string) => { return s; } };
>ResultIsBoolean5 : boolean, Symbol(ResultIsBoolean5,Decl(deleteOperatorWithStringType.ts,23,3))
>delete { x: "", y: (s: string) => { return s; } } : boolean
>{ x: "", y: (s: string) => { return s; } } : { x: string; y: (s: string) => string; }
>x : string, Symbol(x,Decl(deleteOperatorWithStringType.ts,23,31))
>"" : string
>y : (s: string) => string, Symbol(y,Decl(deleteOperatorWithStringType.ts,23,38))
>(s: string) => { return s; } : (s: string) => string
>s : string, Symbol(s,Decl(deleteOperatorWithStringType.ts,23,43))
>s : string, Symbol(s,Decl(deleteOperatorWithStringType.ts,23,43))
// string type expressions
var ResultIsBoolean6 = delete objA.a;
>ResultIsBoolean6 : boolean, Symbol(ResultIsBoolean6,Decl(deleteOperatorWithStringType.ts,26,3))
>delete objA.a : boolean
>objA.a : string, Symbol(A.a,Decl(deleteOperatorWithStringType.ts,6,9))
>objA : A, Symbol(objA,Decl(deleteOperatorWithStringType.ts,14,3))
>a : string, Symbol(A.a,Decl(deleteOperatorWithStringType.ts,6,9))
var ResultIsBoolean7 = delete M.n;
>ResultIsBoolean7 : boolean, Symbol(ResultIsBoolean7,Decl(deleteOperatorWithStringType.ts,27,3))
>delete M.n : boolean
>M.n : string, Symbol(M.n,Decl(deleteOperatorWithStringType.ts,11,14))
>M : typeof M, Symbol(M,Decl(deleteOperatorWithStringType.ts,9,1))
>n : string, Symbol(M.n,Decl(deleteOperatorWithStringType.ts,11,14))
var ResultIsBoolean8 = delete STRING1[0];
>ResultIsBoolean8 : boolean, Symbol(ResultIsBoolean8,Decl(deleteOperatorWithStringType.ts,28,3))
>delete STRING1[0] : boolean
>STRING1[0] : string
>STRING1 : string[], Symbol(STRING1,Decl(deleteOperatorWithStringType.ts,2,3))
>0 : number
var ResultIsBoolean9 = delete foo();
>ResultIsBoolean9 : boolean, Symbol(ResultIsBoolean9,Decl(deleteOperatorWithStringType.ts,29,3))
>delete foo() : boolean
>foo() : string
>foo : () => string, Symbol(foo,Decl(deleteOperatorWithStringType.ts,2,36))
var ResultIsBoolean10 = delete A.foo();
>ResultIsBoolean10 : boolean, Symbol(ResultIsBoolean10,Decl(deleteOperatorWithStringType.ts,30,3))
>delete A.foo() : boolean
>A.foo() : string
>A.foo : () => string, Symbol(A.foo,Decl(deleteOperatorWithStringType.ts,7,21))
>A : typeof A, Symbol(A,Decl(deleteOperatorWithStringType.ts,4,40))
>foo : () => string, Symbol(A.foo,Decl(deleteOperatorWithStringType.ts,7,21))
var ResultIsBoolean11 = delete (STRING + STRING);
>ResultIsBoolean11 : boolean, Symbol(ResultIsBoolean11,Decl(deleteOperatorWithStringType.ts,31,3))
>delete (STRING + STRING) : boolean
>(STRING + STRING) : string
>STRING + STRING : string
>STRING : string, Symbol(STRING,Decl(deleteOperatorWithStringType.ts,1,3))
>STRING : string, Symbol(STRING,Decl(deleteOperatorWithStringType.ts,1,3))
var ResultIsBoolean12 = delete STRING.charAt(0);
>ResultIsBoolean12 : boolean, Symbol(ResultIsBoolean12,Decl(deleteOperatorWithStringType.ts,32,3))
>delete STRING.charAt(0) : boolean
>STRING.charAt(0) : string
>STRING.charAt : (pos: number) => string, Symbol(String.charAt,Decl(lib.d.ts,279,23))
>STRING : string, Symbol(STRING,Decl(deleteOperatorWithStringType.ts,1,3))
>charAt : (pos: number) => string, Symbol(String.charAt,Decl(lib.d.ts,279,23))
>0 : number
// multiple delete operator
var ResultIsBoolean13 = delete delete STRING;
>ResultIsBoolean13 : boolean, Symbol(ResultIsBoolean13,Decl(deleteOperatorWithStringType.ts,35,3))
>delete delete STRING : boolean
>delete STRING : boolean
>STRING : string, Symbol(STRING,Decl(deleteOperatorWithStringType.ts,1,3))
var ResultIsBoolean14 = delete delete delete (STRING + STRING);
>ResultIsBoolean14 : boolean, Symbol(ResultIsBoolean14,Decl(deleteOperatorWithStringType.ts,36,3))
>delete delete delete (STRING + STRING) : boolean
>delete delete (STRING + STRING) : boolean
>delete (STRING + STRING) : boolean
>(STRING + STRING) : string
>STRING + STRING : string
>STRING : string, Symbol(STRING,Decl(deleteOperatorWithStringType.ts,1,3))
>STRING : string, Symbol(STRING,Decl(deleteOperatorWithStringType.ts,1,3))
// miss assignment operators
delete "";
>delete "" : boolean
>"" : string
delete STRING;
>delete STRING : boolean
>STRING : string, Symbol(STRING,Decl(deleteOperatorWithStringType.ts,1,3))
delete STRING1;
>delete STRING1 : boolean
>STRING1 : string[], Symbol(STRING1,Decl(deleteOperatorWithStringType.ts,2,3))
delete foo();
>delete foo() : boolean
>foo() : string
>foo : () => string, Symbol(foo,Decl(deleteOperatorWithStringType.ts,2,36))
delete objA.a,M.n;
>delete objA.a,M.n : string
>delete objA.a : boolean
>objA.a : string, Symbol(A.a,Decl(deleteOperatorWithStringType.ts,6,9))
>objA : A, Symbol(objA,Decl(deleteOperatorWithStringType.ts,14,3))
>a : string, Symbol(A.a,Decl(deleteOperatorWithStringType.ts,6,9))
>M.n : string, Symbol(M.n,Decl(deleteOperatorWithStringType.ts,11,14))
>M : typeof M, Symbol(M,Decl(deleteOperatorWithStringType.ts,9,1))
>n : string, Symbol(M.n,Decl(deleteOperatorWithStringType.ts,11,14))