Skip to content

Crash on nested array destructuring in pairs iteration: #1163

Description

@GlassBricks

The following example crashes the compiler (assertion failed):
https://typescripttolua.github.io/play#code/FAYw9gdgzgLgBGARgKzgXjgb2HXcCGAXHANoAMAugDQ56LEkCM1wAvsMAGZgBOAFOGjwSAayqkAbhQoJOcAA74Aljyh8kyAJSbseOIKhgANgFMAdEbABzPhM1sgA

Stacktrace:

AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

  nativeAssert(value, message)

    at assert
    at transformArrayBindingElement (/node_modules/typescript-to-lua/dist/transformation/visitors/variable-declaration.js:25:28)
    at /node_modules/typescript-to-lua/dist/transformation/visitors/language-extensions/iterable.js:35:109
    at Array.map (<anonymous>)
    at transformForOfMultiIterableStatement (/node_modules/typescript-to-lua/dist/transformation/visitors/language-extensions/iterable.js:35:44)
    at transformForOfIterableStatement (/node_modules/typescript-to-lua/dist/transformation/visitors/language-extensions/iterable.js:62:16)
    at Object.transformForOfStatement [as transform] (/node_modules/typescript-to-lua/dist/transformation/visitors/loops/for-of.js:34:63)
    at TransformationContext.transformNode (/node_modules/typescript-to-lua/dist/transformation/context/context.js:44:67)
    at /node_modules/typescript-to-lua/dist/transformation/context/context.js:70:63
    at Array.flatMap (<anonymous>) {

There seems to be a TODO comment for this

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions