Skip to content

Constant folding fails for comprehensions containing a shadowed variable #1296

@l46kok

Description

@l46kok

Describe the bug
Attempting to constant fold the following expression: [(x - 1 > 3) ? (x - 1) : 5].exists(x, x - 1 > 3)

Produces the following error:

Optimize() generated an invalid AST: ERROR: <input>:-1:0: constant-folding evaluation failed: no such attribute(s): x

Expected behavior
Though there's nothing to fold, it shouldn't cause an error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions