mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Accept new baselines
This commit is contained in:
@@ -194,9 +194,9 @@ var d5 = [...temp3];
|
||||
|
||||
var d6 = [...temp4];
|
||||
>d6 : any[]
|
||||
>[...temp4] : undefined[]
|
||||
>...temp4 : undefined
|
||||
>temp4 : undefined[]
|
||||
>[...temp4] : any[]
|
||||
>...temp4 : any
|
||||
>temp4 : any[]
|
||||
|
||||
var d7 = [...[...temp1]];
|
||||
>d7 : number[]
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
tests/cases/compiler/controlFlowArrayErrors.ts(6,9): error TS7005: Variable 'y' implicitly has an 'any[]' type.
|
||||
tests/cases/compiler/controlFlowArrayErrors.ts(14,9): error TS7005: Variable 'y' implicitly has an 'any[]' type.
|
||||
tests/cases/compiler/controlFlowArrayErrors.ts(5,9): error TS7034: Variable 'x' implicitly has type 'any[]' in some locations where its type cannot be determined.
|
||||
tests/cases/compiler/controlFlowArrayErrors.ts(6,13): error TS7005: Variable 'x' implicitly has an 'any[]' type.
|
||||
tests/cases/compiler/controlFlowArrayErrors.ts(12,9): error TS7034: Variable 'x' implicitly has type 'any[]' in some locations where its type cannot be determined.
|
||||
tests/cases/compiler/controlFlowArrayErrors.ts(14,13): error TS7005: Variable 'x' implicitly has an 'any[]' type.
|
||||
tests/cases/compiler/controlFlowArrayErrors.ts(20,9): error TS7034: Variable 'x' implicitly has type 'any[]' in some locations where its type cannot be determined.
|
||||
tests/cases/compiler/controlFlowArrayErrors.ts(23,9): error TS7005: Variable 'x' implicitly has an 'any[]' type.
|
||||
tests/cases/compiler/controlFlowArrayErrors.ts(30,12): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'.
|
||||
@@ -10,25 +12,29 @@ tests/cases/compiler/controlFlowArrayErrors.ts(61,11): error TS7034: Variable 'x
|
||||
tests/cases/compiler/controlFlowArrayErrors.ts(64,9): error TS7005: Variable 'x' implicitly has an 'any[]' type.
|
||||
|
||||
|
||||
==== tests/cases/compiler/controlFlowArrayErrors.ts (10 errors) ====
|
||||
==== tests/cases/compiler/controlFlowArrayErrors.ts (12 errors) ====
|
||||
|
||||
declare function cond(): boolean;
|
||||
|
||||
function f1() {
|
||||
let x = [];
|
||||
let y = x; // Implicit any[] error
|
||||
let x = []; // Implicit any[] error in some locations
|
||||
~
|
||||
!!! error TS7005: Variable 'y' implicitly has an 'any[]' type.
|
||||
!!! error TS7034: Variable 'x' implicitly has type 'any[]' in some locations where its type cannot be determined.
|
||||
let y = x; // Implicit any[] error
|
||||
~
|
||||
!!! error TS7005: Variable 'x' implicitly has an 'any[]' type.
|
||||
x.push(5);
|
||||
let z = x;
|
||||
}
|
||||
|
||||
function f2() {
|
||||
let x;
|
||||
x = [];
|
||||
let y = x; // Implicit any[] error
|
||||
let x; // Implicit any[] error in some locations
|
||||
~
|
||||
!!! error TS7005: Variable 'y' implicitly has an 'any[]' type.
|
||||
!!! error TS7034: Variable 'x' implicitly has type 'any[]' in some locations where its type cannot be determined.
|
||||
x = [];
|
||||
let y = x; // Implicit any[] error
|
||||
~
|
||||
!!! error TS7005: Variable 'x' implicitly has an 'any[]' type.
|
||||
x.push(5);
|
||||
let z = x;
|
||||
}
|
||||
@@ -39,7 +45,7 @@ tests/cases/compiler/controlFlowArrayErrors.ts(64,9): error TS7005: Variable 'x'
|
||||
!!! error TS7034: Variable 'x' implicitly has type 'any[]' in some locations where its type cannot be determined.
|
||||
x.push(5);
|
||||
function g() {
|
||||
x; // Implicit any[] error
|
||||
x; // Implicit any[] error
|
||||
~
|
||||
!!! error TS7005: Variable 'x' implicitly has an 'any[]' type.
|
||||
}
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
declare function cond(): boolean;
|
||||
|
||||
function f1() {
|
||||
let x = [];
|
||||
let y = x; // Implicit any[] error
|
||||
let x = []; // Implicit any[] error in some locations
|
||||
let y = x; // Implicit any[] error
|
||||
x.push(5);
|
||||
let z = x;
|
||||
}
|
||||
|
||||
function f2() {
|
||||
let x;
|
||||
let x; // Implicit any[] error in some locations
|
||||
x = [];
|
||||
let y = x; // Implicit any[] error
|
||||
let y = x; // Implicit any[] error
|
||||
x.push(5);
|
||||
let z = x;
|
||||
}
|
||||
@@ -21,7 +21,7 @@ function f3() {
|
||||
let x = []; // Implicit any[] error in some locations
|
||||
x.push(5);
|
||||
function g() {
|
||||
x; // Implicit any[] error
|
||||
x; // Implicit any[] error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,13 +68,13 @@ function f8() {
|
||||
|
||||
//// [controlFlowArrayErrors.js]
|
||||
function f1() {
|
||||
var x = [];
|
||||
var x = []; // Implicit any[] error in some locations
|
||||
var y = x; // Implicit any[] error
|
||||
x.push(5);
|
||||
var z = x;
|
||||
}
|
||||
function f2() {
|
||||
var x;
|
||||
var x; // Implicit any[] error in some locations
|
||||
x = [];
|
||||
var y = x; // Implicit any[] error
|
||||
x.push(5);
|
||||
|
||||
@@ -114,13 +114,19 @@ function f10() {
|
||||
|
||||
function f11() {
|
||||
let x = [];
|
||||
return x; // never[]
|
||||
if (x.length === 0) { // x.length ok on implicit any[]
|
||||
x.push("hello");
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
function f12() {
|
||||
let x;
|
||||
x = [];
|
||||
return x; // never[]
|
||||
if (x.length === 0) { // x.length ok on implicit any[]
|
||||
x.push("hello");
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
function f13() {
|
||||
@@ -278,12 +284,18 @@ function f10() {
|
||||
}
|
||||
function f11() {
|
||||
var x = [];
|
||||
return x; // never[]
|
||||
if (x.length === 0) {
|
||||
x.push("hello");
|
||||
}
|
||||
return x;
|
||||
}
|
||||
function f12() {
|
||||
var x;
|
||||
x = [];
|
||||
return x; // never[]
|
||||
if (x.length === 0) {
|
||||
x.push("hello");
|
||||
}
|
||||
return x;
|
||||
}
|
||||
function f13() {
|
||||
var x = [];
|
||||
|
||||
@@ -282,78 +282,98 @@ function f11() {
|
||||
let x = [];
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 114, 7))
|
||||
|
||||
return x; // never[]
|
||||
if (x.length === 0) { // x.length ok on implicit any[]
|
||||
>x.length : Symbol(Array.length, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 114, 7))
|
||||
>length : Symbol(Array.length, Decl(lib.d.ts, --, --))
|
||||
|
||||
x.push("hello");
|
||||
>x.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 114, 7))
|
||||
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
}
|
||||
return x;
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 114, 7))
|
||||
}
|
||||
|
||||
function f12() {
|
||||
>f12 : Symbol(f12, Decl(controlFlowArrays.ts, 116, 1))
|
||||
>f12 : Symbol(f12, Decl(controlFlowArrays.ts, 119, 1))
|
||||
|
||||
let x;
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 119, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 122, 7))
|
||||
|
||||
x = [];
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 119, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 122, 7))
|
||||
|
||||
return x; // never[]
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 119, 7))
|
||||
if (x.length === 0) { // x.length ok on implicit any[]
|
||||
>x.length : Symbol(Array.length, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 122, 7))
|
||||
>length : Symbol(Array.length, Decl(lib.d.ts, --, --))
|
||||
|
||||
x.push("hello");
|
||||
>x.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 122, 7))
|
||||
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
}
|
||||
return x;
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 122, 7))
|
||||
}
|
||||
|
||||
function f13() {
|
||||
>f13 : Symbol(f13, Decl(controlFlowArrays.ts, 122, 1))
|
||||
>f13 : Symbol(f13, Decl(controlFlowArrays.ts, 128, 1))
|
||||
|
||||
var x = [];
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 125, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 131, 7))
|
||||
|
||||
x.push(5);
|
||||
>x.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 125, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 131, 7))
|
||||
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
|
||||
x.push("hello");
|
||||
>x.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 125, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 131, 7))
|
||||
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
|
||||
x.push(true);
|
||||
>x.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 125, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 131, 7))
|
||||
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
|
||||
return x; // (string | number | boolean)[]
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 125, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 131, 7))
|
||||
}
|
||||
|
||||
function f14() {
|
||||
>f14 : Symbol(f14, Decl(controlFlowArrays.ts, 130, 1))
|
||||
>f14 : Symbol(f14, Decl(controlFlowArrays.ts, 136, 1))
|
||||
|
||||
const x = [];
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 133, 9))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 139, 9))
|
||||
|
||||
x.push(5);
|
||||
>x.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 133, 9))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 139, 9))
|
||||
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
|
||||
x.push("hello");
|
||||
>x.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 133, 9))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 139, 9))
|
||||
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
|
||||
x.push(true);
|
||||
>x.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 133, 9))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 139, 9))
|
||||
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
|
||||
return x; // (string | number | boolean)[]
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 133, 9))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 139, 9))
|
||||
}
|
||||
|
||||
function f15() {
|
||||
>f15 : Symbol(f15, Decl(controlFlowArrays.ts, 138, 1))
|
||||
>f15 : Symbol(f15, Decl(controlFlowArrays.ts, 144, 1))
|
||||
|
||||
let x = [];
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 141, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 147, 7))
|
||||
|
||||
while (cond()) {
|
||||
>cond : Symbol(cond, Decl(controlFlowArrays.ts, 0, 0))
|
||||
@@ -363,88 +383,88 @@ function f15() {
|
||||
|
||||
x.push("hello");
|
||||
>x.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 141, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 147, 7))
|
||||
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
}
|
||||
return x; // string[]
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 141, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 147, 7))
|
||||
}
|
||||
|
||||
function f16() {
|
||||
>f16 : Symbol(f16, Decl(controlFlowArrays.ts, 147, 1))
|
||||
>f16 : Symbol(f16, Decl(controlFlowArrays.ts, 153, 1))
|
||||
|
||||
let x;
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 150, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 156, 7))
|
||||
|
||||
let y;
|
||||
>y : Symbol(y, Decl(controlFlowArrays.ts, 151, 7))
|
||||
>y : Symbol(y, Decl(controlFlowArrays.ts, 157, 7))
|
||||
|
||||
(x = [], x).push(5);
|
||||
>(x = [], x).push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 150, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 150, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 156, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 156, 7))
|
||||
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
|
||||
(x.push("hello"), x).push(true);
|
||||
>(x.push("hello"), x).push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
>x.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 150, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 156, 7))
|
||||
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 150, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 156, 7))
|
||||
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
|
||||
((x))[3] = { a: 1 };
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 150, 7))
|
||||
>a : Symbol(a, Decl(controlFlowArrays.ts, 154, 16))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 156, 7))
|
||||
>a : Symbol(a, Decl(controlFlowArrays.ts, 160, 16))
|
||||
|
||||
return x; // (string | number | boolean | { a: number })[]
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 150, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 156, 7))
|
||||
}
|
||||
|
||||
function f17() {
|
||||
>f17 : Symbol(f17, Decl(controlFlowArrays.ts, 156, 1))
|
||||
>f17 : Symbol(f17, Decl(controlFlowArrays.ts, 162, 1))
|
||||
|
||||
let x = [];
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 159, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 165, 7))
|
||||
|
||||
x.unshift(5);
|
||||
>x.unshift : Symbol(Array.unshift, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 159, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 165, 7))
|
||||
>unshift : Symbol(Array.unshift, Decl(lib.d.ts, --, --))
|
||||
|
||||
x.unshift("hello");
|
||||
>x.unshift : Symbol(Array.unshift, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 159, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 165, 7))
|
||||
>unshift : Symbol(Array.unshift, Decl(lib.d.ts, --, --))
|
||||
|
||||
x.unshift(true);
|
||||
>x.unshift : Symbol(Array.unshift, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 159, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 165, 7))
|
||||
>unshift : Symbol(Array.unshift, Decl(lib.d.ts, --, --))
|
||||
|
||||
return x; // (string | number | boolean)[]
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 159, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 165, 7))
|
||||
}
|
||||
|
||||
function f18() {
|
||||
>f18 : Symbol(f18, Decl(controlFlowArrays.ts, 164, 1))
|
||||
>f18 : Symbol(f18, Decl(controlFlowArrays.ts, 170, 1))
|
||||
|
||||
let x = [];
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 167, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 173, 7))
|
||||
|
||||
x.push(5);
|
||||
>x.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 167, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 173, 7))
|
||||
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
|
||||
x.unshift("hello");
|
||||
>x.unshift : Symbol(Array.unshift, Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 167, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 173, 7))
|
||||
>unshift : Symbol(Array.unshift, Decl(lib.d.ts, --, --))
|
||||
|
||||
x[2] = true;
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 167, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 173, 7))
|
||||
|
||||
return x; // (string | number | boolean)[]
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 167, 7))
|
||||
>x : Symbol(x, Decl(controlFlowArrays.ts, 173, 7))
|
||||
}
|
||||
|
||||
@@ -357,18 +357,32 @@ function f10() {
|
||||
}
|
||||
|
||||
function f11() {
|
||||
>f11 : () => never[]
|
||||
>f11 : () => string[]
|
||||
|
||||
let x = [];
|
||||
>x : any[]
|
||||
>[] : never[]
|
||||
|
||||
return x; // never[]
|
||||
>x : never[]
|
||||
if (x.length === 0) { // x.length ok on implicit any[]
|
||||
>x.length === 0 : boolean
|
||||
>x.length : number
|
||||
>x : any[]
|
||||
>length : number
|
||||
>0 : 0
|
||||
|
||||
x.push("hello");
|
||||
>x.push("hello") : number
|
||||
>x.push : (...items: any[]) => number
|
||||
>x : any[]
|
||||
>push : (...items: any[]) => number
|
||||
>"hello" : "hello"
|
||||
}
|
||||
return x;
|
||||
>x : string[]
|
||||
}
|
||||
|
||||
function f12() {
|
||||
>f12 : () => never[]
|
||||
>f12 : () => string[]
|
||||
|
||||
let x;
|
||||
>x : any
|
||||
@@ -378,8 +392,22 @@ function f12() {
|
||||
>x : any
|
||||
>[] : never[]
|
||||
|
||||
return x; // never[]
|
||||
>x : never[]
|
||||
if (x.length === 0) { // x.length ok on implicit any[]
|
||||
>x.length === 0 : boolean
|
||||
>x.length : number
|
||||
>x : any[]
|
||||
>length : number
|
||||
>0 : 0
|
||||
|
||||
x.push("hello");
|
||||
>x.push("hello") : number
|
||||
>x.push : (...items: any[]) => number
|
||||
>x : any[]
|
||||
>push : (...items: any[]) => number
|
||||
>"hello" : "hello"
|
||||
}
|
||||
return x;
|
||||
>x : string[]
|
||||
}
|
||||
|
||||
function f13() {
|
||||
|
||||
@@ -105,7 +105,7 @@ function filter<A>(f: (a: A) => boolean, ar: A[]): A[] {
|
||||
} );
|
||||
|
||||
return ret;
|
||||
>ret : undefined[]
|
||||
>ret : any[]
|
||||
}
|
||||
|
||||
// length :: [a] -> Num
|
||||
|
||||
@@ -13,7 +13,7 @@ var parts = [];
|
||||
|
||||
// Ensure that the generated code is correct
|
||||
parts[0];
|
||||
>parts[0] : undefined
|
||||
>parts : undefined[]
|
||||
>parts[0] : any
|
||||
>parts : any[]
|
||||
>0 : 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user