mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-12 12:57:11 -06:00
Accept new baselines
This commit is contained in:
parent
307a9b66af
commit
519e19ae03
@ -0,0 +1,47 @@
|
||||
tests/cases/conformance/es6/destructuring/destructuringControlFlow.ts(31,8): error TS2339: Property 'x' does not exist on type 'Number'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringControlFlow.ts(32,9): error TS2339: Property 'x' does not exist on type 'Number'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringControlFlow.ts(33,9): error TS2537: Type 'Number' has no matching index signature for type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/destructuring/destructuringControlFlow.ts (3 errors) ====
|
||||
function f1(obj: { a?: string }) {
|
||||
if (obj.a) {
|
||||
obj = {};
|
||||
let a1 = obj["a"]; // string | undefined
|
||||
let a2 = obj.a; // string | undefined
|
||||
}
|
||||
}
|
||||
|
||||
function f2(obj: [number, string] | null[]) {
|
||||
let a0 = obj[0]; // number | null
|
||||
let a1 = obj[1]; // string | null
|
||||
let [b0, b1] = obj;
|
||||
([a0, a1] = obj);
|
||||
if (obj[0] && obj[1]) {
|
||||
let c0 = obj[0]; // number
|
||||
let c1 = obj[1]; // string
|
||||
let [d0, d1] = obj;
|
||||
([c0, c1] = obj);
|
||||
}
|
||||
}
|
||||
|
||||
function f3(obj: { a?: number, b?: string }) {
|
||||
if (obj.a && obj.b) {
|
||||
let { a, b } = obj; // number, string
|
||||
({ a, b } = obj);
|
||||
}
|
||||
}
|
||||
|
||||
function f4() {
|
||||
let x: boolean;
|
||||
({ x } = 0); // Error
|
||||
~
|
||||
!!! error TS2339: Property 'x' does not exist on type 'Number'.
|
||||
({ ["x"]: x } = 0); // Error
|
||||
~~~
|
||||
!!! error TS2339: Property 'x' does not exist on type 'Number'.
|
||||
({ ["x" + ""]: x } = 0); // Errpr
|
||||
~~~~~~~~
|
||||
!!! error TS2537: Type 'Number' has no matching index signature for type 'string'.
|
||||
}
|
||||
|
||||
71
tests/baselines/reference/destructuringControlFlow.js
Normal file
71
tests/baselines/reference/destructuringControlFlow.js
Normal file
@ -0,0 +1,71 @@
|
||||
//// [destructuringControlFlow.ts]
|
||||
function f1(obj: { a?: string }) {
|
||||
if (obj.a) {
|
||||
obj = {};
|
||||
let a1 = obj["a"]; // string | undefined
|
||||
let a2 = obj.a; // string | undefined
|
||||
}
|
||||
}
|
||||
|
||||
function f2(obj: [number, string] | null[]) {
|
||||
let a0 = obj[0]; // number | null
|
||||
let a1 = obj[1]; // string | null
|
||||
let [b0, b1] = obj;
|
||||
([a0, a1] = obj);
|
||||
if (obj[0] && obj[1]) {
|
||||
let c0 = obj[0]; // number
|
||||
let c1 = obj[1]; // string
|
||||
let [d0, d1] = obj;
|
||||
([c0, c1] = obj);
|
||||
}
|
||||
}
|
||||
|
||||
function f3(obj: { a?: number, b?: string }) {
|
||||
if (obj.a && obj.b) {
|
||||
let { a, b } = obj; // number, string
|
||||
({ a, b } = obj);
|
||||
}
|
||||
}
|
||||
|
||||
function f4() {
|
||||
let x: boolean;
|
||||
({ x } = 0); // Error
|
||||
({ ["x"]: x } = 0); // Error
|
||||
({ ["x" + ""]: x } = 0); // Errpr
|
||||
}
|
||||
|
||||
|
||||
//// [destructuringControlFlow.js]
|
||||
"use strict";
|
||||
function f1(obj) {
|
||||
if (obj.a) {
|
||||
obj = {};
|
||||
var a1 = obj["a"]; // string | undefined
|
||||
var a2 = obj.a; // string | undefined
|
||||
}
|
||||
}
|
||||
function f2(obj) {
|
||||
var a0 = obj[0]; // number | null
|
||||
var a1 = obj[1]; // string | null
|
||||
var b0 = obj[0], b1 = obj[1];
|
||||
(a0 = obj[0], a1 = obj[1]);
|
||||
if (obj[0] && obj[1]) {
|
||||
var c0 = obj[0]; // number
|
||||
var c1 = obj[1]; // string
|
||||
var d0 = obj[0], d1 = obj[1];
|
||||
(c0 = obj[0], c1 = obj[1]);
|
||||
}
|
||||
}
|
||||
function f3(obj) {
|
||||
if (obj.a && obj.b) {
|
||||
var a = obj.a, b = obj.b; // number, string
|
||||
(a = obj.a, b = obj.b);
|
||||
}
|
||||
}
|
||||
function f4() {
|
||||
var _a;
|
||||
var x;
|
||||
(x = 0..x); // Error
|
||||
(x = 0["x"]); // Error
|
||||
(_a = "x" + "", x = 0[_a]); // Errpr
|
||||
}
|
||||
124
tests/baselines/reference/destructuringControlFlow.symbols
Normal file
124
tests/baselines/reference/destructuringControlFlow.symbols
Normal file
@ -0,0 +1,124 @@
|
||||
=== tests/cases/conformance/es6/destructuring/destructuringControlFlow.ts ===
|
||||
function f1(obj: { a?: string }) {
|
||||
>f1 : Symbol(f1, Decl(destructuringControlFlow.ts, 0, 0))
|
||||
>obj : Symbol(obj, Decl(destructuringControlFlow.ts, 0, 12))
|
||||
>a : Symbol(a, Decl(destructuringControlFlow.ts, 0, 18))
|
||||
|
||||
if (obj.a) {
|
||||
>obj.a : Symbol(a, Decl(destructuringControlFlow.ts, 0, 18))
|
||||
>obj : Symbol(obj, Decl(destructuringControlFlow.ts, 0, 12))
|
||||
>a : Symbol(a, Decl(destructuringControlFlow.ts, 0, 18))
|
||||
|
||||
obj = {};
|
||||
>obj : Symbol(obj, Decl(destructuringControlFlow.ts, 0, 12))
|
||||
|
||||
let a1 = obj["a"]; // string | undefined
|
||||
>a1 : Symbol(a1, Decl(destructuringControlFlow.ts, 3, 11))
|
||||
>obj : Symbol(obj, Decl(destructuringControlFlow.ts, 0, 12))
|
||||
>"a" : Symbol(a, Decl(destructuringControlFlow.ts, 0, 18))
|
||||
|
||||
let a2 = obj.a; // string | undefined
|
||||
>a2 : Symbol(a2, Decl(destructuringControlFlow.ts, 4, 11))
|
||||
>obj.a : Symbol(a, Decl(destructuringControlFlow.ts, 0, 18))
|
||||
>obj : Symbol(obj, Decl(destructuringControlFlow.ts, 0, 12))
|
||||
>a : Symbol(a, Decl(destructuringControlFlow.ts, 0, 18))
|
||||
}
|
||||
}
|
||||
|
||||
function f2(obj: [number, string] | null[]) {
|
||||
>f2 : Symbol(f2, Decl(destructuringControlFlow.ts, 6, 1))
|
||||
>obj : Symbol(obj, Decl(destructuringControlFlow.ts, 8, 12))
|
||||
|
||||
let a0 = obj[0]; // number | null
|
||||
>a0 : Symbol(a0, Decl(destructuringControlFlow.ts, 9, 7))
|
||||
>obj : Symbol(obj, Decl(destructuringControlFlow.ts, 8, 12))
|
||||
>0 : Symbol(0)
|
||||
|
||||
let a1 = obj[1]; // string | null
|
||||
>a1 : Symbol(a1, Decl(destructuringControlFlow.ts, 10, 7))
|
||||
>obj : Symbol(obj, Decl(destructuringControlFlow.ts, 8, 12))
|
||||
>1 : Symbol(1)
|
||||
|
||||
let [b0, b1] = obj;
|
||||
>b0 : Symbol(b0, Decl(destructuringControlFlow.ts, 11, 9))
|
||||
>b1 : Symbol(b1, Decl(destructuringControlFlow.ts, 11, 12))
|
||||
>obj : Symbol(obj, Decl(destructuringControlFlow.ts, 8, 12))
|
||||
|
||||
([a0, a1] = obj);
|
||||
>a0 : Symbol(a0, Decl(destructuringControlFlow.ts, 9, 7))
|
||||
>a1 : Symbol(a1, Decl(destructuringControlFlow.ts, 10, 7))
|
||||
>obj : Symbol(obj, Decl(destructuringControlFlow.ts, 8, 12))
|
||||
|
||||
if (obj[0] && obj[1]) {
|
||||
>obj : Symbol(obj, Decl(destructuringControlFlow.ts, 8, 12))
|
||||
>0 : Symbol(0)
|
||||
>obj : Symbol(obj, Decl(destructuringControlFlow.ts, 8, 12))
|
||||
>1 : Symbol(1)
|
||||
|
||||
let c0 = obj[0]; // number
|
||||
>c0 : Symbol(c0, Decl(destructuringControlFlow.ts, 14, 11))
|
||||
>obj : Symbol(obj, Decl(destructuringControlFlow.ts, 8, 12))
|
||||
>0 : Symbol(0)
|
||||
|
||||
let c1 = obj[1]; // string
|
||||
>c1 : Symbol(c1, Decl(destructuringControlFlow.ts, 15, 11))
|
||||
>obj : Symbol(obj, Decl(destructuringControlFlow.ts, 8, 12))
|
||||
>1 : Symbol(1)
|
||||
|
||||
let [d0, d1] = obj;
|
||||
>d0 : Symbol(d0, Decl(destructuringControlFlow.ts, 16, 13))
|
||||
>d1 : Symbol(d1, Decl(destructuringControlFlow.ts, 16, 16))
|
||||
>obj : Symbol(obj, Decl(destructuringControlFlow.ts, 8, 12))
|
||||
|
||||
([c0, c1] = obj);
|
||||
>c0 : Symbol(c0, Decl(destructuringControlFlow.ts, 14, 11))
|
||||
>c1 : Symbol(c1, Decl(destructuringControlFlow.ts, 15, 11))
|
||||
>obj : Symbol(obj, Decl(destructuringControlFlow.ts, 8, 12))
|
||||
}
|
||||
}
|
||||
|
||||
function f3(obj: { a?: number, b?: string }) {
|
||||
>f3 : Symbol(f3, Decl(destructuringControlFlow.ts, 19, 1))
|
||||
>obj : Symbol(obj, Decl(destructuringControlFlow.ts, 21, 12))
|
||||
>a : Symbol(a, Decl(destructuringControlFlow.ts, 21, 18))
|
||||
>b : Symbol(b, Decl(destructuringControlFlow.ts, 21, 30))
|
||||
|
||||
if (obj.a && obj.b) {
|
||||
>obj.a : Symbol(a, Decl(destructuringControlFlow.ts, 21, 18))
|
||||
>obj : Symbol(obj, Decl(destructuringControlFlow.ts, 21, 12))
|
||||
>a : Symbol(a, Decl(destructuringControlFlow.ts, 21, 18))
|
||||
>obj.b : Symbol(b, Decl(destructuringControlFlow.ts, 21, 30))
|
||||
>obj : Symbol(obj, Decl(destructuringControlFlow.ts, 21, 12))
|
||||
>b : Symbol(b, Decl(destructuringControlFlow.ts, 21, 30))
|
||||
|
||||
let { a, b } = obj; // number, string
|
||||
>a : Symbol(a, Decl(destructuringControlFlow.ts, 23, 13))
|
||||
>b : Symbol(b, Decl(destructuringControlFlow.ts, 23, 16))
|
||||
>obj : Symbol(obj, Decl(destructuringControlFlow.ts, 21, 12))
|
||||
|
||||
({ a, b } = obj);
|
||||
>a : Symbol(a, Decl(destructuringControlFlow.ts, 24, 10))
|
||||
>b : Symbol(b, Decl(destructuringControlFlow.ts, 24, 13))
|
||||
>obj : Symbol(obj, Decl(destructuringControlFlow.ts, 21, 12))
|
||||
}
|
||||
}
|
||||
|
||||
function f4() {
|
||||
>f4 : Symbol(f4, Decl(destructuringControlFlow.ts, 26, 1))
|
||||
|
||||
let x: boolean;
|
||||
>x : Symbol(x, Decl(destructuringControlFlow.ts, 29, 7))
|
||||
|
||||
({ x } = 0); // Error
|
||||
>x : Symbol(x, Decl(destructuringControlFlow.ts, 30, 6))
|
||||
|
||||
({ ["x"]: x } = 0); // Error
|
||||
>["x"] : Symbol(["x"], Decl(destructuringControlFlow.ts, 31, 6))
|
||||
>"x" : Symbol(["x"], Decl(destructuringControlFlow.ts, 31, 6))
|
||||
>x : Symbol(x, Decl(destructuringControlFlow.ts, 29, 7))
|
||||
|
||||
({ ["x" + ""]: x } = 0); // Errpr
|
||||
>["x" + ""] : Symbol(["x" + ""], Decl(destructuringControlFlow.ts, 32, 6))
|
||||
>x : Symbol(x, Decl(destructuringControlFlow.ts, 29, 7))
|
||||
}
|
||||
|
||||
160
tests/baselines/reference/destructuringControlFlow.types
Normal file
160
tests/baselines/reference/destructuringControlFlow.types
Normal file
@ -0,0 +1,160 @@
|
||||
=== tests/cases/conformance/es6/destructuring/destructuringControlFlow.ts ===
|
||||
function f1(obj: { a?: string }) {
|
||||
>f1 : (obj: { a?: string | undefined; }) => void
|
||||
>obj : { a?: string | undefined; }
|
||||
>a : string | undefined
|
||||
|
||||
if (obj.a) {
|
||||
>obj.a : string | undefined
|
||||
>obj : { a?: string | undefined; }
|
||||
>a : string | undefined
|
||||
|
||||
obj = {};
|
||||
>obj = {} : {}
|
||||
>obj : { a?: string | undefined; }
|
||||
>{} : {}
|
||||
|
||||
let a1 = obj["a"]; // string | undefined
|
||||
>a1 : string | undefined
|
||||
>obj["a"] : string | undefined
|
||||
>obj : { a?: string | undefined; }
|
||||
>"a" : "a"
|
||||
|
||||
let a2 = obj.a; // string | undefined
|
||||
>a2 : string | undefined
|
||||
>obj.a : string | undefined
|
||||
>obj : { a?: string | undefined; }
|
||||
>a : string | undefined
|
||||
}
|
||||
}
|
||||
|
||||
function f2(obj: [number, string] | null[]) {
|
||||
>f2 : (obj: [number, string] | null[]) => void
|
||||
>obj : [number, string] | null[]
|
||||
>null : null
|
||||
|
||||
let a0 = obj[0]; // number | null
|
||||
>a0 : number | null
|
||||
>obj[0] : number | null
|
||||
>obj : [number, string] | null[]
|
||||
>0 : 0
|
||||
|
||||
let a1 = obj[1]; // string | null
|
||||
>a1 : string | null
|
||||
>obj[1] : string | null
|
||||
>obj : [number, string] | null[]
|
||||
>1 : 1
|
||||
|
||||
let [b0, b1] = obj;
|
||||
>b0 : number | null
|
||||
>b1 : string | null
|
||||
>obj : [number, string] | null[]
|
||||
|
||||
([a0, a1] = obj);
|
||||
>([a0, a1] = obj) : [number, string] | null[]
|
||||
>[a0, a1] = obj : [number, string] | null[]
|
||||
>[a0, a1] : [number | null, string | null]
|
||||
>a0 : number | null
|
||||
>a1 : string | null
|
||||
>obj : [number, string] | null[]
|
||||
|
||||
if (obj[0] && obj[1]) {
|
||||
>obj[0] && obj[1] : string | 0 | null
|
||||
>obj[0] : number | null
|
||||
>obj : [number, string] | null[]
|
||||
>0 : 0
|
||||
>obj[1] : string | null
|
||||
>obj : [number, string] | null[]
|
||||
>1 : 1
|
||||
|
||||
let c0 = obj[0]; // number
|
||||
>c0 : number
|
||||
>obj[0] : number
|
||||
>obj : [number, string] | null[]
|
||||
>0 : 0
|
||||
|
||||
let c1 = obj[1]; // string
|
||||
>c1 : string
|
||||
>obj[1] : string
|
||||
>obj : [number, string] | null[]
|
||||
>1 : 1
|
||||
|
||||
let [d0, d1] = obj;
|
||||
>d0 : number
|
||||
>d1 : string
|
||||
>obj : [number, string] | null[]
|
||||
|
||||
([c0, c1] = obj);
|
||||
>([c0, c1] = obj) : [number, string] | null[]
|
||||
>[c0, c1] = obj : [number, string] | null[]
|
||||
>[c0, c1] : [number, string]
|
||||
>c0 : number
|
||||
>c1 : string
|
||||
>obj : [number, string] | null[]
|
||||
}
|
||||
}
|
||||
|
||||
function f3(obj: { a?: number, b?: string }) {
|
||||
>f3 : (obj: { a?: number | undefined; b?: string | undefined; }) => void
|
||||
>obj : { a?: number | undefined; b?: string | undefined; }
|
||||
>a : number | undefined
|
||||
>b : string | undefined
|
||||
|
||||
if (obj.a && obj.b) {
|
||||
>obj.a && obj.b : string | 0 | undefined
|
||||
>obj.a : number | undefined
|
||||
>obj : { a?: number | undefined; b?: string | undefined; }
|
||||
>a : number | undefined
|
||||
>obj.b : string | undefined
|
||||
>obj : { a?: number | undefined; b?: string | undefined; }
|
||||
>b : string | undefined
|
||||
|
||||
let { a, b } = obj; // number, string
|
||||
>a : number
|
||||
>b : string
|
||||
>obj : { a?: number | undefined; b?: string | undefined; }
|
||||
|
||||
({ a, b } = obj);
|
||||
>({ a, b } = obj) : { a?: number | undefined; b?: string | undefined; }
|
||||
>{ a, b } = obj : { a?: number | undefined; b?: string | undefined; }
|
||||
>{ a, b } : { a: number; b: string; }
|
||||
>a : number
|
||||
>b : string
|
||||
>obj : { a?: number | undefined; b?: string | undefined; }
|
||||
}
|
||||
}
|
||||
|
||||
function f4() {
|
||||
>f4 : () => void
|
||||
|
||||
let x: boolean;
|
||||
>x : boolean
|
||||
|
||||
({ x } = 0); // Error
|
||||
>({ x } = 0) : 0
|
||||
>{ x } = 0 : 0
|
||||
>{ x } : { x: boolean; }
|
||||
>x : boolean
|
||||
>0 : 0
|
||||
|
||||
({ ["x"]: x } = 0); // Error
|
||||
>({ ["x"]: x } = 0) : 0
|
||||
>{ ["x"]: x } = 0 : 0
|
||||
>{ ["x"]: x } : { ["x"]: boolean; }
|
||||
>["x"] : boolean
|
||||
>"x" : "x"
|
||||
>x : boolean
|
||||
>0 : 0
|
||||
|
||||
({ ["x" + ""]: x } = 0); // Errpr
|
||||
>({ ["x" + ""]: x } = 0) : 0
|
||||
>{ ["x" + ""]: x } = 0 : 0
|
||||
>{ ["x" + ""]: x } : { [x: string]: boolean; }
|
||||
>["x" + ""] : boolean
|
||||
>"x" + "" : string
|
||||
>"x" : "x"
|
||||
>"" : ""
|
||||
>x : boolean
|
||||
>0 : 0
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user