Skip to content

array.filter with function literal broken when using noImplicitSelf #1295

@GlassBricks

Description

@GlassBricks

The following breaks using tstl v1.6.0:

const array = [1, 2, 3]
array.filter(x => x>1)

The output lua is this:

array = {1, 2, 3}
__TS__ArrayFilter(
    array,
    function(x) return x > 1 end
)

The function is missing a filler parameter for the self parameter. When it runs, it crashes trying to compare x (due to the missing filler, is the self parameter, nil) to 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions