mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 11:35:42 -06:00
Add comments to tests
This commit is contained in:
parent
6ae5337511
commit
6c2344ee35
@ -2,6 +2,7 @@
|
||||
|
||||
declare let cond: boolean;
|
||||
|
||||
// CFA for 'let' with no type annotation and initializer
|
||||
function f1() {
|
||||
let x;
|
||||
if (cond) {
|
||||
@ -10,9 +11,10 @@ function f1() {
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const y = x; // string | number
|
||||
}
|
||||
|
||||
// CFA for 'let' with no type annotation and 'undefined' initializer
|
||||
function f2() {
|
||||
let x = undefined;
|
||||
if (cond) {
|
||||
@ -21,9 +23,10 @@ function f2() {
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const y = x; // string | number
|
||||
}
|
||||
|
||||
// CFA for 'let' with no type annotation and 'null' initializer
|
||||
function f3() {
|
||||
let x = null;
|
||||
if (cond) {
|
||||
@ -32,9 +35,10 @@ function f3() {
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const y = x; // string | number
|
||||
}
|
||||
|
||||
// No CFA for 'let' with with type annotation
|
||||
function f4() {
|
||||
let x: any;
|
||||
if (cond) {
|
||||
@ -43,9 +47,10 @@ function f4() {
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const y = x; // any
|
||||
}
|
||||
|
||||
// CFA for 'var' with no type annotation and initializer
|
||||
function f5() {
|
||||
var x;
|
||||
if (cond) {
|
||||
@ -54,9 +59,10 @@ function f5() {
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const y = x; // string | number
|
||||
}
|
||||
|
||||
// CFA for 'var' with no type annotation and 'undefined' initializer
|
||||
function f6() {
|
||||
var x = undefined;
|
||||
if (cond) {
|
||||
@ -65,9 +71,10 @@ function f6() {
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const y = x; // string | number
|
||||
}
|
||||
|
||||
// CFA for 'var' with no type annotation and 'null' initializer
|
||||
function f7() {
|
||||
var x = null;
|
||||
if (cond) {
|
||||
@ -76,9 +83,10 @@ function f7() {
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const y = x; // string | number
|
||||
}
|
||||
|
||||
// No CFA for 'var' with with type annotation
|
||||
function f8() {
|
||||
var x: any;
|
||||
if (cond) {
|
||||
@ -87,9 +95,10 @@ function f8() {
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const y = x; // any
|
||||
}
|
||||
|
||||
// No CFA for captured outer variables
|
||||
function f9() {
|
||||
let x;
|
||||
if (cond) {
|
||||
@ -98,12 +107,13 @@ function f9() {
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const y = x; // string | number
|
||||
function f() {
|
||||
const z = x;
|
||||
const z = x; // any
|
||||
}
|
||||
}
|
||||
|
||||
// No CFA for captured outer variables
|
||||
function f10() {
|
||||
let x;
|
||||
if (cond) {
|
||||
@ -112,8 +122,8 @@ function f10() {
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const y = x; // string | number
|
||||
const f = () => {
|
||||
const z = x;
|
||||
const z = x; // any
|
||||
};
|
||||
}
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
declare let cond: boolean;
|
||||
|
||||
// CFA for 'let' with no type annotation and initializer
|
||||
function f1() {
|
||||
let x;
|
||||
if (cond) {
|
||||
@ -11,9 +12,10 @@ function f1() {
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const y = x; // string | number
|
||||
}
|
||||
|
||||
// CFA for 'let' with no type annotation and 'undefined' initializer
|
||||
function f2() {
|
||||
let x = undefined;
|
||||
if (cond) {
|
||||
@ -22,9 +24,10 @@ function f2() {
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const y = x; // string | number
|
||||
}
|
||||
|
||||
// CFA for 'let' with no type annotation and 'null' initializer
|
||||
function f3() {
|
||||
let x = null;
|
||||
if (cond) {
|
||||
@ -33,9 +36,10 @@ function f3() {
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const y = x; // string | number
|
||||
}
|
||||
|
||||
// No CFA for 'let' with with type annotation
|
||||
function f4() {
|
||||
let x: any;
|
||||
if (cond) {
|
||||
@ -44,9 +48,10 @@ function f4() {
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const y = x; // any
|
||||
}
|
||||
|
||||
// CFA for 'var' with no type annotation and initializer
|
||||
function f5() {
|
||||
var x;
|
||||
if (cond) {
|
||||
@ -55,9 +60,10 @@ function f5() {
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const y = x; // string | number
|
||||
}
|
||||
|
||||
// CFA for 'var' with no type annotation and 'undefined' initializer
|
||||
function f6() {
|
||||
var x = undefined;
|
||||
if (cond) {
|
||||
@ -66,9 +72,10 @@ function f6() {
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const y = x; // string | number
|
||||
}
|
||||
|
||||
// CFA for 'var' with no type annotation and 'null' initializer
|
||||
function f7() {
|
||||
var x = null;
|
||||
if (cond) {
|
||||
@ -77,9 +84,10 @@ function f7() {
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const y = x; // string | number
|
||||
}
|
||||
|
||||
// No CFA for 'var' with with type annotation
|
||||
function f8() {
|
||||
var x: any;
|
||||
if (cond) {
|
||||
@ -88,9 +96,10 @@ function f8() {
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const y = x; // any
|
||||
}
|
||||
|
||||
// No CFA for captured outer variables
|
||||
function f9() {
|
||||
let x;
|
||||
if (cond) {
|
||||
@ -99,12 +108,13 @@ function f9() {
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const y = x; // string | number
|
||||
function f() {
|
||||
const z = x;
|
||||
const z = x; // any
|
||||
}
|
||||
}
|
||||
|
||||
// No CFA for captured outer variables
|
||||
function f10() {
|
||||
let x;
|
||||
if (cond) {
|
||||
@ -113,8 +123,8 @@ function f10() {
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const y = x; // string | number
|
||||
const f = () => {
|
||||
const z = x;
|
||||
const z = x; // any
|
||||
};
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user