mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 03:23:08 -06:00
Adding test
This commit is contained in:
parent
65468ed352
commit
fb2607c95c
36
tests/baselines/reference/controlFlowDeleteOperator.js
Normal file
36
tests/baselines/reference/controlFlowDeleteOperator.js
Normal file
@ -0,0 +1,36 @@
|
||||
//// [controlFlowDeleteOperator.ts]
|
||||
|
||||
function f() {
|
||||
let x: { a?: number | string, b: number | string } = { b: 1 };
|
||||
x.a;
|
||||
x.b;
|
||||
x.a = 1;
|
||||
x.b = 1;
|
||||
x.a;
|
||||
x.b;
|
||||
delete x.a;
|
||||
delete x.b;
|
||||
x.a;
|
||||
x.b;
|
||||
x;
|
||||
delete x; // No effect
|
||||
x;
|
||||
}
|
||||
|
||||
//// [controlFlowDeleteOperator.js]
|
||||
function f() {
|
||||
var x = { b: 1 };
|
||||
x.a;
|
||||
x.b;
|
||||
x.a = 1;
|
||||
x.b = 1;
|
||||
x.a;
|
||||
x.b;
|
||||
delete x.a;
|
||||
delete x.b;
|
||||
x.a;
|
||||
x.b;
|
||||
x;
|
||||
delete x; // No effect
|
||||
x;
|
||||
}
|
||||
70
tests/baselines/reference/controlFlowDeleteOperator.symbols
Normal file
70
tests/baselines/reference/controlFlowDeleteOperator.symbols
Normal file
@ -0,0 +1,70 @@
|
||||
=== tests/cases/conformance/controlFlow/controlFlowDeleteOperator.ts ===
|
||||
|
||||
function f() {
|
||||
>f : Symbol(f, Decl(controlFlowDeleteOperator.ts, 0, 0))
|
||||
|
||||
let x: { a?: number | string, b: number | string } = { b: 1 };
|
||||
>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12))
|
||||
>b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33))
|
||||
>b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 58))
|
||||
|
||||
x.a;
|
||||
>x.a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12))
|
||||
>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12))
|
||||
|
||||
x.b;
|
||||
>x.b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33))
|
||||
>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7))
|
||||
>b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33))
|
||||
|
||||
x.a = 1;
|
||||
>x.a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12))
|
||||
>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12))
|
||||
|
||||
x.b = 1;
|
||||
>x.b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33))
|
||||
>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7))
|
||||
>b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33))
|
||||
|
||||
x.a;
|
||||
>x.a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12))
|
||||
>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12))
|
||||
|
||||
x.b;
|
||||
>x.b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33))
|
||||
>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7))
|
||||
>b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33))
|
||||
|
||||
delete x.a;
|
||||
>x.a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12))
|
||||
>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12))
|
||||
|
||||
delete x.b;
|
||||
>x.b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33))
|
||||
>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7))
|
||||
>b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33))
|
||||
|
||||
x.a;
|
||||
>x.a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12))
|
||||
>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7))
|
||||
>a : Symbol(a, Decl(controlFlowDeleteOperator.ts, 2, 12))
|
||||
|
||||
x.b;
|
||||
>x.b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33))
|
||||
>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7))
|
||||
>b : Symbol(b, Decl(controlFlowDeleteOperator.ts, 2, 33))
|
||||
|
||||
x;
|
||||
>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7))
|
||||
|
||||
delete x; // No effect
|
||||
>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7))
|
||||
|
||||
x;
|
||||
>x : Symbol(x, Decl(controlFlowDeleteOperator.ts, 2, 7))
|
||||
}
|
||||
79
tests/baselines/reference/controlFlowDeleteOperator.types
Normal file
79
tests/baselines/reference/controlFlowDeleteOperator.types
Normal file
@ -0,0 +1,79 @@
|
||||
=== tests/cases/conformance/controlFlow/controlFlowDeleteOperator.ts ===
|
||||
|
||||
function f() {
|
||||
>f : () => void
|
||||
|
||||
let x: { a?: number | string, b: number | string } = { b: 1 };
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>a : number | string | undefined
|
||||
>b : number | string
|
||||
>{ b: 1 } : { b: number; }
|
||||
>b : number
|
||||
>1 : number
|
||||
|
||||
x.a;
|
||||
>x.a : number | string | undefined
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>a : number | string | undefined
|
||||
|
||||
x.b;
|
||||
>x.b : number | string
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>b : number | string
|
||||
|
||||
x.a = 1;
|
||||
>x.a = 1 : number
|
||||
>x.a : number | string | undefined
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>a : number | string | undefined
|
||||
>1 : number
|
||||
|
||||
x.b = 1;
|
||||
>x.b = 1 : number
|
||||
>x.b : number | string
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>b : number | string
|
||||
>1 : number
|
||||
|
||||
x.a;
|
||||
>x.a : number
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>a : number
|
||||
|
||||
x.b;
|
||||
>x.b : number
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>b : number
|
||||
|
||||
delete x.a;
|
||||
>delete x.a : boolean
|
||||
>x.a : number
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>a : number
|
||||
|
||||
delete x.b;
|
||||
>delete x.b : boolean
|
||||
>x.b : number
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>b : number
|
||||
|
||||
x.a;
|
||||
>x.a : undefined
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>a : undefined
|
||||
|
||||
x.b;
|
||||
>x.b : number | string
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>b : number | string
|
||||
|
||||
x;
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
|
||||
delete x; // No effect
|
||||
>delete x : boolean
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
|
||||
x;
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
// @strictNullChecks: true
|
||||
|
||||
function f() {
|
||||
let x: { a?: number | string, b: number | string } = { b: 1 };
|
||||
x.a;
|
||||
x.b;
|
||||
x.a = 1;
|
||||
x.b = 1;
|
||||
x.a;
|
||||
x.b;
|
||||
delete x.a;
|
||||
delete x.b;
|
||||
x.a;
|
||||
x.b;
|
||||
x;
|
||||
delete x; // No effect
|
||||
x;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user