Skip to content

length operator on nil/boolean returns 0 instead of raising #404

Description

@davydog187

Found while building an error-fidelity test battery for the perf work (#403).

return #nil and return #true both evaluate to 0. PUC-Lua 5.3 raises:

lua: attempt to get length of a nil value
lua: attempt to get length of a boolean value

Present on main independent of the peephole pass (reproduces with peephole: false and on commits before #403). Likely a missing type check in the length-operator implementation shared by both engines.

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