mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 04:43:37 -05:00
Adding regression test
This commit is contained in:
40
tests/baselines/reference/controlFlowIteration.js
Normal file
40
tests/baselines/reference/controlFlowIteration.js
Normal file
@@ -0,0 +1,40 @@
|
||||
//// [controlFlowIteration.ts]
|
||||
|
||||
let cond: boolean;
|
||||
|
||||
function ff() {
|
||||
let x: string | undefined;
|
||||
while (true) {
|
||||
if (cond) {
|
||||
x = "";
|
||||
}
|
||||
else {
|
||||
if (x) {
|
||||
x.length;
|
||||
}
|
||||
if (x) {
|
||||
x.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [controlFlowIteration.js]
|
||||
var cond;
|
||||
function ff() {
|
||||
var x;
|
||||
while (true) {
|
||||
if (cond) {
|
||||
x = "";
|
||||
}
|
||||
else {
|
||||
if (x) {
|
||||
x.length;
|
||||
}
|
||||
if (x) {
|
||||
x.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
39
tests/baselines/reference/controlFlowIteration.symbols
Normal file
39
tests/baselines/reference/controlFlowIteration.symbols
Normal file
@@ -0,0 +1,39 @@
|
||||
=== tests/cases/conformance/controlFlow/controlFlowIteration.ts ===
|
||||
|
||||
let cond: boolean;
|
||||
>cond : Symbol(cond, Decl(controlFlowIteration.ts, 1, 3))
|
||||
|
||||
function ff() {
|
||||
>ff : Symbol(ff, Decl(controlFlowIteration.ts, 1, 18))
|
||||
|
||||
let x: string | undefined;
|
||||
>x : Symbol(x, Decl(controlFlowIteration.ts, 4, 7))
|
||||
|
||||
while (true) {
|
||||
if (cond) {
|
||||
>cond : Symbol(cond, Decl(controlFlowIteration.ts, 1, 3))
|
||||
|
||||
x = "";
|
||||
>x : Symbol(x, Decl(controlFlowIteration.ts, 4, 7))
|
||||
}
|
||||
else {
|
||||
if (x) {
|
||||
>x : Symbol(x, Decl(controlFlowIteration.ts, 4, 7))
|
||||
|
||||
x.length;
|
||||
>x.length : Symbol(String.length, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowIteration.ts, 4, 7))
|
||||
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
|
||||
}
|
||||
if (x) {
|
||||
>x : Symbol(x, Decl(controlFlowIteration.ts, 4, 7))
|
||||
|
||||
x.length;
|
||||
>x.length : Symbol(String.length, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowIteration.ts, 4, 7))
|
||||
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
43
tests/baselines/reference/controlFlowIteration.types
Normal file
43
tests/baselines/reference/controlFlowIteration.types
Normal file
@@ -0,0 +1,43 @@
|
||||
=== tests/cases/conformance/controlFlow/controlFlowIteration.ts ===
|
||||
|
||||
let cond: boolean;
|
||||
>cond : boolean
|
||||
|
||||
function ff() {
|
||||
>ff : () => void
|
||||
|
||||
let x: string | undefined;
|
||||
>x : string | undefined
|
||||
|
||||
while (true) {
|
||||
>true : boolean
|
||||
|
||||
if (cond) {
|
||||
>cond : boolean
|
||||
|
||||
x = "";
|
||||
>x = "" : string
|
||||
>x : string | undefined
|
||||
>"" : string
|
||||
}
|
||||
else {
|
||||
if (x) {
|
||||
>x : string | undefined
|
||||
|
||||
x.length;
|
||||
>x.length : number
|
||||
>x : string
|
||||
>length : number
|
||||
}
|
||||
if (x) {
|
||||
>x : string | undefined
|
||||
|
||||
x.length;
|
||||
>x.length : number
|
||||
>x : string
|
||||
>length : number
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
20
tests/cases/conformance/controlFlow/controlFlowIteration.ts
Normal file
20
tests/cases/conformance/controlFlow/controlFlowIteration.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
// @strictNullChecks: true
|
||||
|
||||
let cond: boolean;
|
||||
|
||||
function ff() {
|
||||
let x: string | undefined;
|
||||
while (true) {
|
||||
if (cond) {
|
||||
x = "";
|
||||
}
|
||||
else {
|
||||
if (x) {
|
||||
x.length;
|
||||
}
|
||||
if (x) {
|
||||
x.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user