From cc7a24c27f1428a7c476a704f778a6579a287633 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sun, 30 Jun 2019 08:18:08 -1000 Subject: [PATCH] Accept new baselines --- ...cturingWithLiteralInitializers2.errors.txt | 55 ++++++ .../destructuringWithLiteralInitializers2.js | 92 ++++++++++ ...tructuringWithLiteralInitializers2.symbols | 113 ++++++++++++ ...estructuringWithLiteralInitializers2.types | 165 ++++++++++++++++++ 4 files changed, 425 insertions(+) create mode 100644 tests/baselines/reference/destructuringWithLiteralInitializers2.errors.txt create mode 100644 tests/baselines/reference/destructuringWithLiteralInitializers2.js create mode 100644 tests/baselines/reference/destructuringWithLiteralInitializers2.symbols create mode 100644 tests/baselines/reference/destructuringWithLiteralInitializers2.types diff --git a/tests/baselines/reference/destructuringWithLiteralInitializers2.errors.txt b/tests/baselines/reference/destructuringWithLiteralInitializers2.errors.txt new file mode 100644 index 00000000000..983f853f9a4 --- /dev/null +++ b/tests/baselines/reference/destructuringWithLiteralInitializers2.errors.txt @@ -0,0 +1,55 @@ +tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts(1,15): error TS7031: Binding element 'x' implicitly has an 'any' type. +tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts(1,18): error TS7031: Binding element 'y' implicitly has an 'any' type. +tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts(2,15): error TS7031: Binding element 'x' implicitly has an 'any' type. +tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts(2,18): error TS7031: Binding element 'y' implicitly has an 'any' type. +tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts(3,18): error TS7031: Binding element 'y' implicitly has an 'any' type. +tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts(6,22): error TS7031: Binding element 'y' implicitly has an 'any' type. +tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts(7,22): error TS7031: Binding element 'y' implicitly has an 'any' type. +tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts(8,22): error TS7031: Binding element 'y' implicitly has an 'any' type. + + +==== tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts (8 errors) ==== + function f00([x, y]) {} + ~ +!!! error TS7031: Binding element 'x' implicitly has an 'any' type. + ~ +!!! error TS7031: Binding element 'y' implicitly has an 'any' type. + function f01([x, y] = []) {} + ~ +!!! error TS7031: Binding element 'x' implicitly has an 'any' type. + ~ +!!! error TS7031: Binding element 'y' implicitly has an 'any' type. + function f02([x, y] = [1]) {} + ~ +!!! error TS7031: Binding element 'y' implicitly has an 'any' type. + function f03([x, y] = [1, 'foo']) {} + + function f10([x = 0, y]) {} + ~ +!!! error TS7031: Binding element 'y' implicitly has an 'any' type. + function f11([x = 0, y] = []) {} + ~ +!!! error TS7031: Binding element 'y' implicitly has an 'any' type. + function f12([x = 0, y] = [1]) {} + ~ +!!! error TS7031: Binding element 'y' implicitly has an 'any' type. + function f13([x = 0, y] = [1, 'foo']) {} + + function f20([x = 0, y = 'bar']) {} + function f21([x = 0, y = 'bar'] = []) {} + function f22([x = 0, y = 'bar'] = [1]) {} + function f23([x = 0, y = 'bar'] = [1, 'foo']) {} + + declare const nx: number | undefined; + declare const sx: string | undefined; + + function f30([x = 0, y = 'bar']) {} + function f31([x = 0, y = 'bar'] = []) {} + function f32([x = 0, y = 'bar'] = [nx]) {} + function f33([x = 0, y = 'bar'] = [nx, sx]) {} + + function f40([x = 0, y = 'bar']) {} + function f41([x = 0, y = 'bar'] = []) {} + function f42([x = 0, y = 'bar'] = [sx]) {} + function f43([x = 0, y = 'bar'] = [sx, nx]) {} + \ No newline at end of file diff --git a/tests/baselines/reference/destructuringWithLiteralInitializers2.js b/tests/baselines/reference/destructuringWithLiteralInitializers2.js new file mode 100644 index 00000000000..1f3ee956144 --- /dev/null +++ b/tests/baselines/reference/destructuringWithLiteralInitializers2.js @@ -0,0 +1,92 @@ +//// [destructuringWithLiteralInitializers2.ts] +function f00([x, y]) {} +function f01([x, y] = []) {} +function f02([x, y] = [1]) {} +function f03([x, y] = [1, 'foo']) {} + +function f10([x = 0, y]) {} +function f11([x = 0, y] = []) {} +function f12([x = 0, y] = [1]) {} +function f13([x = 0, y] = [1, 'foo']) {} + +function f20([x = 0, y = 'bar']) {} +function f21([x = 0, y = 'bar'] = []) {} +function f22([x = 0, y = 'bar'] = [1]) {} +function f23([x = 0, y = 'bar'] = [1, 'foo']) {} + +declare const nx: number | undefined; +declare const sx: string | undefined; + +function f30([x = 0, y = 'bar']) {} +function f31([x = 0, y = 'bar'] = []) {} +function f32([x = 0, y = 'bar'] = [nx]) {} +function f33([x = 0, y = 'bar'] = [nx, sx]) {} + +function f40([x = 0, y = 'bar']) {} +function f41([x = 0, y = 'bar'] = []) {} +function f42([x = 0, y = 'bar'] = [sx]) {} +function f43([x = 0, y = 'bar'] = [sx, nx]) {} + + +//// [destructuringWithLiteralInitializers2.js] +"use strict"; +function f00(_a) { + var x = _a[0], y = _a[1]; +} +function f01(_a) { + var _b = _a === void 0 ? [] : _a, x = _b[0], y = _b[1]; +} +function f02(_a) { + var _b = _a === void 0 ? [1] : _a, x = _b[0], y = _b[1]; +} +function f03(_a) { + var _b = _a === void 0 ? [1, 'foo'] : _a, x = _b[0], y = _b[1]; +} +function f10(_a) { + var _b = _a[0], x = _b === void 0 ? 0 : _b, y = _a[1]; +} +function f11(_a) { + var _b = _a === void 0 ? [] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, y = _b[1]; +} +function f12(_a) { + var _b = _a === void 0 ? [1] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, y = _b[1]; +} +function f13(_a) { + var _b = _a === void 0 ? [1, 'foo'] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, y = _b[1]; +} +function f20(_a) { + var _b = _a[0], x = _b === void 0 ? 0 : _b, _c = _a[1], y = _c === void 0 ? 'bar' : _c; +} +function f21(_a) { + var _b = _a === void 0 ? [] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, _d = _b[1], y = _d === void 0 ? 'bar' : _d; +} +function f22(_a) { + var _b = _a === void 0 ? [1] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, _d = _b[1], y = _d === void 0 ? 'bar' : _d; +} +function f23(_a) { + var _b = _a === void 0 ? [1, 'foo'] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, _d = _b[1], y = _d === void 0 ? 'bar' : _d; +} +function f30(_a) { + var _b = _a[0], x = _b === void 0 ? 0 : _b, _c = _a[1], y = _c === void 0 ? 'bar' : _c; +} +function f31(_a) { + var _b = _a === void 0 ? [] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, _d = _b[1], y = _d === void 0 ? 'bar' : _d; +} +function f32(_a) { + var _b = _a === void 0 ? [nx] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, _d = _b[1], y = _d === void 0 ? 'bar' : _d; +} +function f33(_a) { + var _b = _a === void 0 ? [nx, sx] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, _d = _b[1], y = _d === void 0 ? 'bar' : _d; +} +function f40(_a) { + var _b = _a[0], x = _b === void 0 ? 0 : _b, _c = _a[1], y = _c === void 0 ? 'bar' : _c; +} +function f41(_a) { + var _b = _a === void 0 ? [] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, _d = _b[1], y = _d === void 0 ? 'bar' : _d; +} +function f42(_a) { + var _b = _a === void 0 ? [sx] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, _d = _b[1], y = _d === void 0 ? 'bar' : _d; +} +function f43(_a) { + var _b = _a === void 0 ? [sx, nx] : _a, _c = _b[0], x = _c === void 0 ? 0 : _c, _d = _b[1], y = _d === void 0 ? 'bar' : _d; +} diff --git a/tests/baselines/reference/destructuringWithLiteralInitializers2.symbols b/tests/baselines/reference/destructuringWithLiteralInitializers2.symbols new file mode 100644 index 00000000000..44224ac22a4 --- /dev/null +++ b/tests/baselines/reference/destructuringWithLiteralInitializers2.symbols @@ -0,0 +1,113 @@ +=== tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts === +function f00([x, y]) {} +>f00 : Symbol(f00, Decl(destructuringWithLiteralInitializers2.ts, 0, 0)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 0, 14)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 0, 16)) + +function f01([x, y] = []) {} +>f01 : Symbol(f01, Decl(destructuringWithLiteralInitializers2.ts, 0, 23)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 1, 14)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 1, 16)) + +function f02([x, y] = [1]) {} +>f02 : Symbol(f02, Decl(destructuringWithLiteralInitializers2.ts, 1, 28)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 2, 14)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 2, 16)) + +function f03([x, y] = [1, 'foo']) {} +>f03 : Symbol(f03, Decl(destructuringWithLiteralInitializers2.ts, 2, 29)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 3, 14)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 3, 16)) + +function f10([x = 0, y]) {} +>f10 : Symbol(f10, Decl(destructuringWithLiteralInitializers2.ts, 3, 36)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 5, 14)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 5, 20)) + +function f11([x = 0, y] = []) {} +>f11 : Symbol(f11, Decl(destructuringWithLiteralInitializers2.ts, 5, 27)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 6, 14)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 6, 20)) + +function f12([x = 0, y] = [1]) {} +>f12 : Symbol(f12, Decl(destructuringWithLiteralInitializers2.ts, 6, 32)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 7, 14)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 7, 20)) + +function f13([x = 0, y] = [1, 'foo']) {} +>f13 : Symbol(f13, Decl(destructuringWithLiteralInitializers2.ts, 7, 33)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 8, 14)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 8, 20)) + +function f20([x = 0, y = 'bar']) {} +>f20 : Symbol(f20, Decl(destructuringWithLiteralInitializers2.ts, 8, 40)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 10, 14)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 10, 20)) + +function f21([x = 0, y = 'bar'] = []) {} +>f21 : Symbol(f21, Decl(destructuringWithLiteralInitializers2.ts, 10, 35)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 11, 14)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 11, 20)) + +function f22([x = 0, y = 'bar'] = [1]) {} +>f22 : Symbol(f22, Decl(destructuringWithLiteralInitializers2.ts, 11, 40)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 12, 14)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 12, 20)) + +function f23([x = 0, y = 'bar'] = [1, 'foo']) {} +>f23 : Symbol(f23, Decl(destructuringWithLiteralInitializers2.ts, 12, 41)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 13, 14)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 13, 20)) + +declare const nx: number | undefined; +>nx : Symbol(nx, Decl(destructuringWithLiteralInitializers2.ts, 15, 13)) + +declare const sx: string | undefined; +>sx : Symbol(sx, Decl(destructuringWithLiteralInitializers2.ts, 16, 13)) + +function f30([x = 0, y = 'bar']) {} +>f30 : Symbol(f30, Decl(destructuringWithLiteralInitializers2.ts, 16, 37)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 18, 14)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 18, 20)) + +function f31([x = 0, y = 'bar'] = []) {} +>f31 : Symbol(f31, Decl(destructuringWithLiteralInitializers2.ts, 18, 35)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 19, 14)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 19, 20)) + +function f32([x = 0, y = 'bar'] = [nx]) {} +>f32 : Symbol(f32, Decl(destructuringWithLiteralInitializers2.ts, 19, 40)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 20, 14)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 20, 20)) +>nx : Symbol(nx, Decl(destructuringWithLiteralInitializers2.ts, 15, 13)) + +function f33([x = 0, y = 'bar'] = [nx, sx]) {} +>f33 : Symbol(f33, Decl(destructuringWithLiteralInitializers2.ts, 20, 42)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 21, 14)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 21, 20)) +>nx : Symbol(nx, Decl(destructuringWithLiteralInitializers2.ts, 15, 13)) +>sx : Symbol(sx, Decl(destructuringWithLiteralInitializers2.ts, 16, 13)) + +function f40([x = 0, y = 'bar']) {} +>f40 : Symbol(f40, Decl(destructuringWithLiteralInitializers2.ts, 21, 46)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 23, 14)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 23, 20)) + +function f41([x = 0, y = 'bar'] = []) {} +>f41 : Symbol(f41, Decl(destructuringWithLiteralInitializers2.ts, 23, 35)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 24, 14)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 24, 20)) + +function f42([x = 0, y = 'bar'] = [sx]) {} +>f42 : Symbol(f42, Decl(destructuringWithLiteralInitializers2.ts, 24, 40)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 25, 14)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 25, 20)) +>sx : Symbol(sx, Decl(destructuringWithLiteralInitializers2.ts, 16, 13)) + +function f43([x = 0, y = 'bar'] = [sx, nx]) {} +>f43 : Symbol(f43, Decl(destructuringWithLiteralInitializers2.ts, 25, 42)) +>x : Symbol(x, Decl(destructuringWithLiteralInitializers2.ts, 26, 14)) +>y : Symbol(y, Decl(destructuringWithLiteralInitializers2.ts, 26, 20)) +>sx : Symbol(sx, Decl(destructuringWithLiteralInitializers2.ts, 16, 13)) +>nx : Symbol(nx, Decl(destructuringWithLiteralInitializers2.ts, 15, 13)) + diff --git a/tests/baselines/reference/destructuringWithLiteralInitializers2.types b/tests/baselines/reference/destructuringWithLiteralInitializers2.types new file mode 100644 index 00000000000..7f955912e74 --- /dev/null +++ b/tests/baselines/reference/destructuringWithLiteralInitializers2.types @@ -0,0 +1,165 @@ +=== tests/cases/conformance/es6/destructuring/destructuringWithLiteralInitializers2.ts === +function f00([x, y]) {} +>f00 : ([x, y]: [any, any]) => void +>x : any +>y : any + +function f01([x, y] = []) {} +>f01 : ([x, y]?: [any?, any?]) => void +>x : any +>y : any +>[] : [] + +function f02([x, y] = [1]) {} +>f02 : ([x, y]?: [number, any?]) => void +>x : number +>y : any +>[1] : [number] +>1 : 1 + +function f03([x, y] = [1, 'foo']) {} +>f03 : ([x, y]?: [number, string]) => void +>x : number +>y : string +>[1, 'foo'] : [number, string] +>1 : 1 +>'foo' : "foo" + +function f10([x = 0, y]) {} +>f10 : ([x, y]: [number | undefined, any]) => void +>x : number +>0 : 0 +>y : any + +function f11([x = 0, y] = []) {} +>f11 : ([x, y]?: [(number | undefined)?, any?]) => void +>x : number +>0 : 0 +>y : any +>[] : [] + +function f12([x = 0, y] = [1]) {} +>f12 : ([x, y]?: [number, any?]) => void +>x : number +>0 : 0 +>y : any +>[1] : [number] +>1 : 1 + +function f13([x = 0, y] = [1, 'foo']) {} +>f13 : ([x, y]?: [number, string]) => void +>x : number +>0 : 0 +>y : string +>[1, 'foo'] : [number, string] +>1 : 1 +>'foo' : "foo" + +function f20([x = 0, y = 'bar']) {} +>f20 : ([x, y]: [(number | undefined)?, (string | undefined)?]) => void +>x : number +>0 : 0 +>y : string +>'bar' : "bar" + +function f21([x = 0, y = 'bar'] = []) {} +>f21 : ([x, y]?: [(number | undefined)?, (string | undefined)?]) => void +>x : number +>0 : 0 +>y : string +>'bar' : "bar" +>[] : [] + +function f22([x = 0, y = 'bar'] = [1]) {} +>f22 : ([x, y]?: [number, (string | undefined)?]) => void +>x : number +>0 : 0 +>y : string +>'bar' : "bar" +>[1] : [number] +>1 : 1 + +function f23([x = 0, y = 'bar'] = [1, 'foo']) {} +>f23 : ([x, y]?: [number, string]) => void +>x : number +>0 : 0 +>y : string +>'bar' : "bar" +>[1, 'foo'] : [number, string] +>1 : 1 +>'foo' : "foo" + +declare const nx: number | undefined; +>nx : number | undefined + +declare const sx: string | undefined; +>sx : string | undefined + +function f30([x = 0, y = 'bar']) {} +>f30 : ([x, y]: [(number | undefined)?, (string | undefined)?]) => void +>x : number +>0 : 0 +>y : string +>'bar' : "bar" + +function f31([x = 0, y = 'bar'] = []) {} +>f31 : ([x, y]?: [(number | undefined)?, (string | undefined)?]) => void +>x : number +>0 : 0 +>y : string +>'bar' : "bar" +>[] : [] + +function f32([x = 0, y = 'bar'] = [nx]) {} +>f32 : ([x, y]?: [number | undefined, (string | undefined)?]) => void +>x : number +>0 : 0 +>y : string +>'bar' : "bar" +>[nx] : [number | undefined] +>nx : number | undefined + +function f33([x = 0, y = 'bar'] = [nx, sx]) {} +>f33 : ([x, y]?: [number | undefined, string | undefined]) => void +>x : number +>0 : 0 +>y : string +>'bar' : "bar" +>[nx, sx] : [number | undefined, string | undefined] +>nx : number | undefined +>sx : string | undefined + +function f40([x = 0, y = 'bar']) {} +>f40 : ([x, y]: [(number | undefined)?, (string | undefined)?]) => void +>x : number +>0 : 0 +>y : string +>'bar' : "bar" + +function f41([x = 0, y = 'bar'] = []) {} +>f41 : ([x, y]?: [(number | undefined)?, (string | undefined)?]) => void +>x : number +>0 : 0 +>y : string +>'bar' : "bar" +>[] : [] + +function f42([x = 0, y = 'bar'] = [sx]) {} +>f42 : ([x, y]?: [string | undefined, (string | undefined)?]) => void +>x : string | number +>0 : 0 +>y : string +>'bar' : "bar" +>[sx] : [string | undefined] +>sx : string | undefined + +function f43([x = 0, y = 'bar'] = [sx, nx]) {} +>f43 : ([x, y]?: [string | undefined, number | undefined]) => void +>x : string | number +>0 : 0 +>y : string | number +>'bar' : "bar" +>[sx, nx] : [string | undefined, number | undefined] +>sx : string | undefined +>nx : number | undefined +