-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Drop variable statements when the declaration list gets transformed to an empty list #59893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
93baf0c
69f0874
1d43b9f
37cfa20
9a99293
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,3 @@ | |
const | ||
|
||
//// [downlevelLetConst1.js] | ||
var ; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spooky given this test is named in such a way that implies that it's testing exactly this transformation? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see https://github.com/microsoft/TypeScript/pull/59893/files#r1749158145 , i think the same principle would apply here this particular test case is testing |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
//// [tests/cases/conformance/es6/destructuring/emptyArrayBindingPattern01.ts] //// | ||
|
||
//// [emptyArrayBindingPattern01.ts] | ||
export const cilBlurLinear1: string[][] = [[]]; | ||
const [,] = cilBlurLinear1; | ||
|
||
export const cilBlurLinear2: string[][] = [[]]; | ||
let [,] = cilBlurLinear2; | ||
|
||
export const cilBlurLinear3: string[][] = [[]]; | ||
var [,] = cilBlurLinear3; | ||
|
||
export const cilBlurLinear4: string[][] = [[]]; | ||
const [[]] = cilBlurLinear4; | ||
|
||
export const cilBlurLinear5: string[][] = [[]]; | ||
let [[]] = cilBlurLinear5; | ||
|
||
export const cilBlurLinear6: string[][] = [[]]; | ||
var [[]] = cilBlurLinear6; | ||
|
||
|
||
//// [emptyArrayBindingPattern01.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.cilBlurLinear6 = exports.cilBlurLinear5 = exports.cilBlurLinear4 = exports.cilBlurLinear3 = exports.cilBlurLinear2 = exports.cilBlurLinear1 = void 0; | ||
exports.cilBlurLinear1 = [[]]; | ||
exports.cilBlurLinear2 = [[]]; | ||
exports.cilBlurLinear3 = [[]]; | ||
exports.cilBlurLinear4 = [[]]; | ||
var _a = exports.cilBlurLinear4[0]; | ||
exports.cilBlurLinear5 = [[]]; | ||
var _b = exports.cilBlurLinear5[0]; | ||
exports.cilBlurLinear6 = [[]]; | ||
var _c = exports.cilBlurLinear6[0]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//// [tests/cases/conformance/es6/destructuring/emptyArrayBindingPattern01.ts] //// | ||
|
||
=== emptyArrayBindingPattern01.ts === | ||
export const cilBlurLinear1: string[][] = [[]]; | ||
>cilBlurLinear1 : Symbol(cilBlurLinear1, Decl(emptyArrayBindingPattern01.ts, 0, 12)) | ||
|
||
const [,] = cilBlurLinear1; | ||
>cilBlurLinear1 : Symbol(cilBlurLinear1, Decl(emptyArrayBindingPattern01.ts, 0, 12)) | ||
|
||
export const cilBlurLinear2: string[][] = [[]]; | ||
>cilBlurLinear2 : Symbol(cilBlurLinear2, Decl(emptyArrayBindingPattern01.ts, 3, 12)) | ||
|
||
let [,] = cilBlurLinear2; | ||
>cilBlurLinear2 : Symbol(cilBlurLinear2, Decl(emptyArrayBindingPattern01.ts, 3, 12)) | ||
|
||
export const cilBlurLinear3: string[][] = [[]]; | ||
>cilBlurLinear3 : Symbol(cilBlurLinear3, Decl(emptyArrayBindingPattern01.ts, 6, 12)) | ||
|
||
var [,] = cilBlurLinear3; | ||
>cilBlurLinear3 : Symbol(cilBlurLinear3, Decl(emptyArrayBindingPattern01.ts, 6, 12)) | ||
|
||
export const cilBlurLinear4: string[][] = [[]]; | ||
>cilBlurLinear4 : Symbol(cilBlurLinear4, Decl(emptyArrayBindingPattern01.ts, 9, 12)) | ||
|
||
const [[]] = cilBlurLinear4; | ||
>cilBlurLinear4 : Symbol(cilBlurLinear4, Decl(emptyArrayBindingPattern01.ts, 9, 12)) | ||
|
||
export const cilBlurLinear5: string[][] = [[]]; | ||
>cilBlurLinear5 : Symbol(cilBlurLinear5, Decl(emptyArrayBindingPattern01.ts, 12, 12)) | ||
|
||
let [[]] = cilBlurLinear5; | ||
>cilBlurLinear5 : Symbol(cilBlurLinear5, Decl(emptyArrayBindingPattern01.ts, 12, 12)) | ||
|
||
export const cilBlurLinear6: string[][] = [[]]; | ||
>cilBlurLinear6 : Symbol(cilBlurLinear6, Decl(emptyArrayBindingPattern01.ts, 15, 12)) | ||
|
||
var [[]] = cilBlurLinear6; | ||
>cilBlurLinear6 : Symbol(cilBlurLinear6, Decl(emptyArrayBindingPattern01.ts, 15, 12)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
//// [tests/cases/conformance/es6/destructuring/emptyArrayBindingPattern01.ts] //// | ||
|
||
=== emptyArrayBindingPattern01.ts === | ||
export const cilBlurLinear1: string[][] = [[]]; | ||
>cilBlurLinear1 : string[][] | ||
> : ^^^^^^^^^^ | ||
>[[]] : undefined[][] | ||
> : ^^^^^^^^^^^^^ | ||
>[] : undefined[] | ||
> : ^^^^^^^^^^^ | ||
|
||
const [,] = cilBlurLinear1; | ||
> : undefined | ||
> : ^^^^^^^^^ | ||
>cilBlurLinear1 : string[][] | ||
> : ^^^^^^^^^^ | ||
|
||
export const cilBlurLinear2: string[][] = [[]]; | ||
>cilBlurLinear2 : string[][] | ||
> : ^^^^^^^^^^ | ||
>[[]] : undefined[][] | ||
> : ^^^^^^^^^^^^^ | ||
>[] : undefined[] | ||
> : ^^^^^^^^^^^ | ||
|
||
let [,] = cilBlurLinear2; | ||
> : undefined | ||
> : ^^^^^^^^^ | ||
>cilBlurLinear2 : string[][] | ||
> : ^^^^^^^^^^ | ||
|
||
export const cilBlurLinear3: string[][] = [[]]; | ||
>cilBlurLinear3 : string[][] | ||
> : ^^^^^^^^^^ | ||
>[[]] : undefined[][] | ||
> : ^^^^^^^^^^^^^ | ||
>[] : undefined[] | ||
> : ^^^^^^^^^^^ | ||
|
||
var [,] = cilBlurLinear3; | ||
> : undefined | ||
> : ^^^^^^^^^ | ||
>cilBlurLinear3 : string[][] | ||
> : ^^^^^^^^^^ | ||
|
||
export const cilBlurLinear4: string[][] = [[]]; | ||
>cilBlurLinear4 : string[][] | ||
> : ^^^^^^^^^^ | ||
>[[]] : undefined[][] | ||
> : ^^^^^^^^^^^^^ | ||
>[] : undefined[] | ||
> : ^^^^^^^^^^^ | ||
|
||
const [[]] = cilBlurLinear4; | ||
>cilBlurLinear4 : string[][] | ||
> : ^^^^^^^^^^ | ||
|
||
export const cilBlurLinear5: string[][] = [[]]; | ||
>cilBlurLinear5 : string[][] | ||
> : ^^^^^^^^^^ | ||
>[[]] : undefined[][] | ||
> : ^^^^^^^^^^^^^ | ||
>[] : undefined[] | ||
> : ^^^^^^^^^^^ | ||
|
||
let [[]] = cilBlurLinear5; | ||
>cilBlurLinear5 : string[][] | ||
> : ^^^^^^^^^^ | ||
|
||
export const cilBlurLinear6: string[][] = [[]]; | ||
>cilBlurLinear6 : string[][] | ||
> : ^^^^^^^^^^ | ||
>[[]] : undefined[][] | ||
> : ^^^^^^^^^^^^^ | ||
>[] : undefined[] | ||
> : ^^^^^^^^^^^ | ||
|
||
var [[]] = cilBlurLinear6; | ||
>cilBlurLinear6 : string[][] | ||
> : ^^^^^^^^^^ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// @module: commonjs | ||
// @target: es5 | ||
|
||
export const cilBlurLinear1: string[][] = [[]]; | ||
const [,] = cilBlurLinear1; | ||
|
||
export const cilBlurLinear2: string[][] = [[]]; | ||
let [,] = cilBlurLinear2; | ||
|
||
export const cilBlurLinear3: string[][] = [[]]; | ||
var [,] = cilBlurLinear3; | ||
|
||
export const cilBlurLinear4: string[][] = [[]]; | ||
const [[]] = cilBlurLinear4; | ||
|
||
export const cilBlurLinear5: string[][] = [[]]; | ||
let [[]] = cilBlurLinear5; | ||
|
||
export const cilBlurLinear6: string[][] = [[]]; | ||
var [[]] = cilBlurLinear6; |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All those inputs are incorrect in the first place. So I'm not quite bothered that they produce different kind of an output. For an invalid input it's OK to emit an invalid output. It just happened that fixing a case for a valid input changed this here - but I think that's fine too. In a similar vein, I think it's OK to drop invalid statements from the invalid input.