mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 03:23:08 -06:00
Accept new baselines
This commit is contained in:
parent
d8ec85775a
commit
0739611df0
227
tests/baselines/reference/controlFlowLetVar.js
Normal file
227
tests/baselines/reference/controlFlowLetVar.js
Normal file
@ -0,0 +1,227 @@
|
||||
//// [controlFlowLetVar.ts]
|
||||
|
||||
declare let cond: boolean;
|
||||
|
||||
function f1() {
|
||||
let x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f2() {
|
||||
let x = undefined;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f3() {
|
||||
let x = null;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f4() {
|
||||
let x: any;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f5() {
|
||||
var x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f6() {
|
||||
var x = undefined;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f7() {
|
||||
var x = null;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f8() {
|
||||
var x: any;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f9() {
|
||||
let x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
function f() {
|
||||
const z = x;
|
||||
}
|
||||
}
|
||||
|
||||
function f10() {
|
||||
let x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const f = () => {
|
||||
const z = x;
|
||||
};
|
||||
}
|
||||
|
||||
//// [controlFlowLetVar.js]
|
||||
function f1() {
|
||||
var x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
var y = x;
|
||||
}
|
||||
function f2() {
|
||||
var x = undefined;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
var y = x;
|
||||
}
|
||||
function f3() {
|
||||
var x = null;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
var y = x;
|
||||
}
|
||||
function f4() {
|
||||
var x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
var y = x;
|
||||
}
|
||||
function f5() {
|
||||
var x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
var y = x;
|
||||
}
|
||||
function f6() {
|
||||
var x = undefined;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
var y = x;
|
||||
}
|
||||
function f7() {
|
||||
var x = null;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
var y = x;
|
||||
}
|
||||
function f8() {
|
||||
var x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
var y = x;
|
||||
}
|
||||
function f9() {
|
||||
var x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
var y = x;
|
||||
function f() {
|
||||
var z = x;
|
||||
}
|
||||
}
|
||||
function f10() {
|
||||
var x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
var y = x;
|
||||
var f = function () {
|
||||
var z = x;
|
||||
};
|
||||
}
|
||||
253
tests/baselines/reference/controlFlowLetVar.symbols
Normal file
253
tests/baselines/reference/controlFlowLetVar.symbols
Normal file
@ -0,0 +1,253 @@
|
||||
=== tests/cases/compiler/controlFlowLetVar.ts ===
|
||||
|
||||
declare let cond: boolean;
|
||||
>cond : Symbol(cond, Decl(controlFlowLetVar.ts, 1, 11))
|
||||
|
||||
function f1() {
|
||||
>f1 : Symbol(f1, Decl(controlFlowLetVar.ts, 1, 26))
|
||||
|
||||
let x;
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 4, 7))
|
||||
|
||||
if (cond) {
|
||||
>cond : Symbol(cond, Decl(controlFlowLetVar.ts, 1, 11))
|
||||
|
||||
x = 1;
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 4, 7))
|
||||
}
|
||||
if (cond) {
|
||||
>cond : Symbol(cond, Decl(controlFlowLetVar.ts, 1, 11))
|
||||
|
||||
x = "hello";
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 4, 7))
|
||||
}
|
||||
const y = x;
|
||||
>y : Symbol(y, Decl(controlFlowLetVar.ts, 11, 9))
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 4, 7))
|
||||
}
|
||||
|
||||
function f2() {
|
||||
>f2 : Symbol(f2, Decl(controlFlowLetVar.ts, 12, 1))
|
||||
|
||||
let x = undefined;
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 15, 7))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
if (cond) {
|
||||
>cond : Symbol(cond, Decl(controlFlowLetVar.ts, 1, 11))
|
||||
|
||||
x = 1;
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 15, 7))
|
||||
}
|
||||
if (cond) {
|
||||
>cond : Symbol(cond, Decl(controlFlowLetVar.ts, 1, 11))
|
||||
|
||||
x = "hello";
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 15, 7))
|
||||
}
|
||||
const y = x;
|
||||
>y : Symbol(y, Decl(controlFlowLetVar.ts, 22, 9))
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 15, 7))
|
||||
}
|
||||
|
||||
function f3() {
|
||||
>f3 : Symbol(f3, Decl(controlFlowLetVar.ts, 23, 1))
|
||||
|
||||
let x = null;
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 26, 7))
|
||||
|
||||
if (cond) {
|
||||
>cond : Symbol(cond, Decl(controlFlowLetVar.ts, 1, 11))
|
||||
|
||||
x = 1;
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 26, 7))
|
||||
}
|
||||
if (cond) {
|
||||
>cond : Symbol(cond, Decl(controlFlowLetVar.ts, 1, 11))
|
||||
|
||||
x = "hello";
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 26, 7))
|
||||
}
|
||||
const y = x;
|
||||
>y : Symbol(y, Decl(controlFlowLetVar.ts, 33, 9))
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 26, 7))
|
||||
}
|
||||
|
||||
function f4() {
|
||||
>f4 : Symbol(f4, Decl(controlFlowLetVar.ts, 34, 1))
|
||||
|
||||
let x: any;
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 37, 7))
|
||||
|
||||
if (cond) {
|
||||
>cond : Symbol(cond, Decl(controlFlowLetVar.ts, 1, 11))
|
||||
|
||||
x = 1;
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 37, 7))
|
||||
}
|
||||
if (cond) {
|
||||
>cond : Symbol(cond, Decl(controlFlowLetVar.ts, 1, 11))
|
||||
|
||||
x = "hello";
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 37, 7))
|
||||
}
|
||||
const y = x;
|
||||
>y : Symbol(y, Decl(controlFlowLetVar.ts, 44, 9))
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 37, 7))
|
||||
}
|
||||
|
||||
function f5() {
|
||||
>f5 : Symbol(f5, Decl(controlFlowLetVar.ts, 45, 1))
|
||||
|
||||
var x;
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 48, 7))
|
||||
|
||||
if (cond) {
|
||||
>cond : Symbol(cond, Decl(controlFlowLetVar.ts, 1, 11))
|
||||
|
||||
x = 1;
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 48, 7))
|
||||
}
|
||||
if (cond) {
|
||||
>cond : Symbol(cond, Decl(controlFlowLetVar.ts, 1, 11))
|
||||
|
||||
x = "hello";
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 48, 7))
|
||||
}
|
||||
const y = x;
|
||||
>y : Symbol(y, Decl(controlFlowLetVar.ts, 55, 9))
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 48, 7))
|
||||
}
|
||||
|
||||
function f6() {
|
||||
>f6 : Symbol(f6, Decl(controlFlowLetVar.ts, 56, 1))
|
||||
|
||||
var x = undefined;
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 59, 7))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
if (cond) {
|
||||
>cond : Symbol(cond, Decl(controlFlowLetVar.ts, 1, 11))
|
||||
|
||||
x = 1;
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 59, 7))
|
||||
}
|
||||
if (cond) {
|
||||
>cond : Symbol(cond, Decl(controlFlowLetVar.ts, 1, 11))
|
||||
|
||||
x = "hello";
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 59, 7))
|
||||
}
|
||||
const y = x;
|
||||
>y : Symbol(y, Decl(controlFlowLetVar.ts, 66, 9))
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 59, 7))
|
||||
}
|
||||
|
||||
function f7() {
|
||||
>f7 : Symbol(f7, Decl(controlFlowLetVar.ts, 67, 1))
|
||||
|
||||
var x = null;
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 70, 7))
|
||||
|
||||
if (cond) {
|
||||
>cond : Symbol(cond, Decl(controlFlowLetVar.ts, 1, 11))
|
||||
|
||||
x = 1;
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 70, 7))
|
||||
}
|
||||
if (cond) {
|
||||
>cond : Symbol(cond, Decl(controlFlowLetVar.ts, 1, 11))
|
||||
|
||||
x = "hello";
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 70, 7))
|
||||
}
|
||||
const y = x;
|
||||
>y : Symbol(y, Decl(controlFlowLetVar.ts, 77, 9))
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 70, 7))
|
||||
}
|
||||
|
||||
function f8() {
|
||||
>f8 : Symbol(f8, Decl(controlFlowLetVar.ts, 78, 1))
|
||||
|
||||
var x: any;
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 81, 7))
|
||||
|
||||
if (cond) {
|
||||
>cond : Symbol(cond, Decl(controlFlowLetVar.ts, 1, 11))
|
||||
|
||||
x = 1;
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 81, 7))
|
||||
}
|
||||
if (cond) {
|
||||
>cond : Symbol(cond, Decl(controlFlowLetVar.ts, 1, 11))
|
||||
|
||||
x = "hello";
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 81, 7))
|
||||
}
|
||||
const y = x;
|
||||
>y : Symbol(y, Decl(controlFlowLetVar.ts, 88, 9))
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 81, 7))
|
||||
}
|
||||
|
||||
function f9() {
|
||||
>f9 : Symbol(f9, Decl(controlFlowLetVar.ts, 89, 1))
|
||||
|
||||
let x;
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 92, 7))
|
||||
|
||||
if (cond) {
|
||||
>cond : Symbol(cond, Decl(controlFlowLetVar.ts, 1, 11))
|
||||
|
||||
x = 1;
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 92, 7))
|
||||
}
|
||||
if (cond) {
|
||||
>cond : Symbol(cond, Decl(controlFlowLetVar.ts, 1, 11))
|
||||
|
||||
x = "hello";
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 92, 7))
|
||||
}
|
||||
const y = x;
|
||||
>y : Symbol(y, Decl(controlFlowLetVar.ts, 99, 9))
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 92, 7))
|
||||
|
||||
function f() {
|
||||
>f : Symbol(f, Decl(controlFlowLetVar.ts, 99, 16))
|
||||
|
||||
const z = x;
|
||||
>z : Symbol(z, Decl(controlFlowLetVar.ts, 101, 13))
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 92, 7))
|
||||
}
|
||||
}
|
||||
|
||||
function f10() {
|
||||
>f10 : Symbol(f10, Decl(controlFlowLetVar.ts, 103, 1))
|
||||
|
||||
let x;
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 106, 7))
|
||||
|
||||
if (cond) {
|
||||
>cond : Symbol(cond, Decl(controlFlowLetVar.ts, 1, 11))
|
||||
|
||||
x = 1;
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 106, 7))
|
||||
}
|
||||
if (cond) {
|
||||
>cond : Symbol(cond, Decl(controlFlowLetVar.ts, 1, 11))
|
||||
|
||||
x = "hello";
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 106, 7))
|
||||
}
|
||||
const y = x;
|
||||
>y : Symbol(y, Decl(controlFlowLetVar.ts, 113, 9))
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 106, 7))
|
||||
|
||||
const f = () => {
|
||||
>f : Symbol(f, Decl(controlFlowLetVar.ts, 114, 9))
|
||||
|
||||
const z = x;
|
||||
>z : Symbol(z, Decl(controlFlowLetVar.ts, 115, 13))
|
||||
>x : Symbol(x, Decl(controlFlowLetVar.ts, 106, 7))
|
||||
|
||||
};
|
||||
}
|
||||
296
tests/baselines/reference/controlFlowLetVar.types
Normal file
296
tests/baselines/reference/controlFlowLetVar.types
Normal file
@ -0,0 +1,296 @@
|
||||
=== tests/cases/compiler/controlFlowLetVar.ts ===
|
||||
|
||||
declare let cond: boolean;
|
||||
>cond : boolean
|
||||
|
||||
function f1() {
|
||||
>f1 : () => void
|
||||
|
||||
let x;
|
||||
>x : any
|
||||
|
||||
if (cond) {
|
||||
>cond : boolean
|
||||
|
||||
x = 1;
|
||||
>x = 1 : 1
|
||||
>x : any
|
||||
>1 : 1
|
||||
}
|
||||
if (cond) {
|
||||
>cond : boolean
|
||||
|
||||
x = "hello";
|
||||
>x = "hello" : "hello"
|
||||
>x : any
|
||||
>"hello" : "hello"
|
||||
}
|
||||
const y = x;
|
||||
>y : string | number | undefined
|
||||
>x : string | number | undefined
|
||||
}
|
||||
|
||||
function f2() {
|
||||
>f2 : () => void
|
||||
|
||||
let x = undefined;
|
||||
>x : any
|
||||
>undefined : undefined
|
||||
|
||||
if (cond) {
|
||||
>cond : boolean
|
||||
|
||||
x = 1;
|
||||
>x = 1 : 1
|
||||
>x : any
|
||||
>1 : 1
|
||||
}
|
||||
if (cond) {
|
||||
>cond : boolean
|
||||
|
||||
x = "hello";
|
||||
>x = "hello" : "hello"
|
||||
>x : any
|
||||
>"hello" : "hello"
|
||||
}
|
||||
const y = x;
|
||||
>y : string | number | undefined
|
||||
>x : string | number | undefined
|
||||
}
|
||||
|
||||
function f3() {
|
||||
>f3 : () => void
|
||||
|
||||
let x = null;
|
||||
>x : any
|
||||
>null : null
|
||||
|
||||
if (cond) {
|
||||
>cond : boolean
|
||||
|
||||
x = 1;
|
||||
>x = 1 : 1
|
||||
>x : any
|
||||
>1 : 1
|
||||
}
|
||||
if (cond) {
|
||||
>cond : boolean
|
||||
|
||||
x = "hello";
|
||||
>x = "hello" : "hello"
|
||||
>x : any
|
||||
>"hello" : "hello"
|
||||
}
|
||||
const y = x;
|
||||
>y : string | number | null
|
||||
>x : string | number | null
|
||||
}
|
||||
|
||||
function f4() {
|
||||
>f4 : () => void
|
||||
|
||||
let x: any;
|
||||
>x : any
|
||||
|
||||
if (cond) {
|
||||
>cond : boolean
|
||||
|
||||
x = 1;
|
||||
>x = 1 : 1
|
||||
>x : any
|
||||
>1 : 1
|
||||
}
|
||||
if (cond) {
|
||||
>cond : boolean
|
||||
|
||||
x = "hello";
|
||||
>x = "hello" : "hello"
|
||||
>x : any
|
||||
>"hello" : "hello"
|
||||
}
|
||||
const y = x;
|
||||
>y : any
|
||||
>x : any
|
||||
}
|
||||
|
||||
function f5() {
|
||||
>f5 : () => void
|
||||
|
||||
var x;
|
||||
>x : any
|
||||
|
||||
if (cond) {
|
||||
>cond : boolean
|
||||
|
||||
x = 1;
|
||||
>x = 1 : 1
|
||||
>x : any
|
||||
>1 : 1
|
||||
}
|
||||
if (cond) {
|
||||
>cond : boolean
|
||||
|
||||
x = "hello";
|
||||
>x = "hello" : "hello"
|
||||
>x : any
|
||||
>"hello" : "hello"
|
||||
}
|
||||
const y = x;
|
||||
>y : string | number | undefined
|
||||
>x : string | number | undefined
|
||||
}
|
||||
|
||||
function f6() {
|
||||
>f6 : () => void
|
||||
|
||||
var x = undefined;
|
||||
>x : any
|
||||
>undefined : undefined
|
||||
|
||||
if (cond) {
|
||||
>cond : boolean
|
||||
|
||||
x = 1;
|
||||
>x = 1 : 1
|
||||
>x : any
|
||||
>1 : 1
|
||||
}
|
||||
if (cond) {
|
||||
>cond : boolean
|
||||
|
||||
x = "hello";
|
||||
>x = "hello" : "hello"
|
||||
>x : any
|
||||
>"hello" : "hello"
|
||||
}
|
||||
const y = x;
|
||||
>y : string | number | undefined
|
||||
>x : string | number | undefined
|
||||
}
|
||||
|
||||
function f7() {
|
||||
>f7 : () => void
|
||||
|
||||
var x = null;
|
||||
>x : any
|
||||
>null : null
|
||||
|
||||
if (cond) {
|
||||
>cond : boolean
|
||||
|
||||
x = 1;
|
||||
>x = 1 : 1
|
||||
>x : any
|
||||
>1 : 1
|
||||
}
|
||||
if (cond) {
|
||||
>cond : boolean
|
||||
|
||||
x = "hello";
|
||||
>x = "hello" : "hello"
|
||||
>x : any
|
||||
>"hello" : "hello"
|
||||
}
|
||||
const y = x;
|
||||
>y : string | number | null
|
||||
>x : string | number | null
|
||||
}
|
||||
|
||||
function f8() {
|
||||
>f8 : () => void
|
||||
|
||||
var x: any;
|
||||
>x : any
|
||||
|
||||
if (cond) {
|
||||
>cond : boolean
|
||||
|
||||
x = 1;
|
||||
>x = 1 : 1
|
||||
>x : any
|
||||
>1 : 1
|
||||
}
|
||||
if (cond) {
|
||||
>cond : boolean
|
||||
|
||||
x = "hello";
|
||||
>x = "hello" : "hello"
|
||||
>x : any
|
||||
>"hello" : "hello"
|
||||
}
|
||||
const y = x;
|
||||
>y : any
|
||||
>x : any
|
||||
}
|
||||
|
||||
function f9() {
|
||||
>f9 : () => void
|
||||
|
||||
let x;
|
||||
>x : any
|
||||
|
||||
if (cond) {
|
||||
>cond : boolean
|
||||
|
||||
x = 1;
|
||||
>x = 1 : 1
|
||||
>x : any
|
||||
>1 : 1
|
||||
}
|
||||
if (cond) {
|
||||
>cond : boolean
|
||||
|
||||
x = "hello";
|
||||
>x = "hello" : "hello"
|
||||
>x : any
|
||||
>"hello" : "hello"
|
||||
}
|
||||
const y = x;
|
||||
>y : string | number | undefined
|
||||
>x : string | number | undefined
|
||||
|
||||
function f() {
|
||||
>f : () => void
|
||||
|
||||
const z = x;
|
||||
>z : any
|
||||
>x : any
|
||||
}
|
||||
}
|
||||
|
||||
function f10() {
|
||||
>f10 : () => void
|
||||
|
||||
let x;
|
||||
>x : any
|
||||
|
||||
if (cond) {
|
||||
>cond : boolean
|
||||
|
||||
x = 1;
|
||||
>x = 1 : 1
|
||||
>x : any
|
||||
>1 : 1
|
||||
}
|
||||
if (cond) {
|
||||
>cond : boolean
|
||||
|
||||
x = "hello";
|
||||
>x = "hello" : "hello"
|
||||
>x : any
|
||||
>"hello" : "hello"
|
||||
}
|
||||
const y = x;
|
||||
>y : string | number | undefined
|
||||
>x : string | number | undefined
|
||||
|
||||
const f = () => {
|
||||
>f : () => void
|
||||
>() => { const z = x; } : () => void
|
||||
|
||||
const z = x;
|
||||
>z : any
|
||||
>x : any
|
||||
|
||||
};
|
||||
}
|
||||
133
tests/baselines/reference/controlFlowNoImplicitAny.errors.txt
Normal file
133
tests/baselines/reference/controlFlowNoImplicitAny.errors.txt
Normal file
@ -0,0 +1,133 @@
|
||||
tests/cases/compiler/controlFlowNoImplicitAny.ts(93,9): error TS7034: Variable 'x' implicitly has type 'any' in some locations where its type cannot be determined.
|
||||
tests/cases/compiler/controlFlowNoImplicitAny.ts(102,19): error TS7005: Variable 'x' implicitly has an 'any' type.
|
||||
tests/cases/compiler/controlFlowNoImplicitAny.ts(107,9): error TS7034: Variable 'x' implicitly has type 'any' in some locations where its type cannot be determined.
|
||||
tests/cases/compiler/controlFlowNoImplicitAny.ts(116,19): error TS7005: Variable 'x' implicitly has an 'any' type.
|
||||
|
||||
|
||||
==== tests/cases/compiler/controlFlowNoImplicitAny.ts (4 errors) ====
|
||||
|
||||
declare let cond: boolean;
|
||||
|
||||
function f1() {
|
||||
let x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f2() {
|
||||
let x = undefined;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f3() {
|
||||
let x = null;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f4() {
|
||||
let x: any;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f5() {
|
||||
var x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f6() {
|
||||
var x = undefined;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f7() {
|
||||
var x = null;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f8() {
|
||||
var x: any;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f9() {
|
||||
let x;
|
||||
~
|
||||
!!! error TS7034: Variable 'x' implicitly has type 'any' in some locations where its type cannot be determined.
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
function f() {
|
||||
const z = x;
|
||||
~
|
||||
!!! error TS7005: Variable 'x' implicitly has an 'any' type.
|
||||
}
|
||||
}
|
||||
|
||||
function f10() {
|
||||
let x;
|
||||
~
|
||||
!!! error TS7034: Variable 'x' implicitly has type 'any' in some locations where its type cannot be determined.
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const f = () => {
|
||||
const z = x;
|
||||
~
|
||||
!!! error TS7005: Variable 'x' implicitly has an 'any' type.
|
||||
};
|
||||
}
|
||||
227
tests/baselines/reference/controlFlowNoImplicitAny.js
Normal file
227
tests/baselines/reference/controlFlowNoImplicitAny.js
Normal file
@ -0,0 +1,227 @@
|
||||
//// [controlFlowNoImplicitAny.ts]
|
||||
|
||||
declare let cond: boolean;
|
||||
|
||||
function f1() {
|
||||
let x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f2() {
|
||||
let x = undefined;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f3() {
|
||||
let x = null;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f4() {
|
||||
let x: any;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f5() {
|
||||
var x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f6() {
|
||||
var x = undefined;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f7() {
|
||||
var x = null;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f8() {
|
||||
var x: any;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
}
|
||||
|
||||
function f9() {
|
||||
let x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
function f() {
|
||||
const z = x;
|
||||
}
|
||||
}
|
||||
|
||||
function f10() {
|
||||
let x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
const y = x;
|
||||
const f = () => {
|
||||
const z = x;
|
||||
};
|
||||
}
|
||||
|
||||
//// [controlFlowNoImplicitAny.js]
|
||||
function f1() {
|
||||
var x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
var y = x;
|
||||
}
|
||||
function f2() {
|
||||
var x = undefined;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
var y = x;
|
||||
}
|
||||
function f3() {
|
||||
var x = null;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
var y = x;
|
||||
}
|
||||
function f4() {
|
||||
var x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
var y = x;
|
||||
}
|
||||
function f5() {
|
||||
var x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
var y = x;
|
||||
}
|
||||
function f6() {
|
||||
var x = undefined;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
var y = x;
|
||||
}
|
||||
function f7() {
|
||||
var x = null;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
var y = x;
|
||||
}
|
||||
function f8() {
|
||||
var x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
var y = x;
|
||||
}
|
||||
function f9() {
|
||||
var x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
var y = x;
|
||||
function f() {
|
||||
var z = x;
|
||||
}
|
||||
}
|
||||
function f10() {
|
||||
var x;
|
||||
if (cond) {
|
||||
x = 1;
|
||||
}
|
||||
if (cond) {
|
||||
x = "hello";
|
||||
}
|
||||
var y = x;
|
||||
var f = function () {
|
||||
var z = x;
|
||||
};
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user