Skip to content

Values in selection can never be read as nil #42

@unlessgames

Description

@unlessgames

---@field start_line integer? Start pattern line index

The values like start_track etc. are notated as integer?, but could they actually be nil? AFAIK either the entire selection itself is nil or every field exists.

I assume this is notated this way because you can assign an incomplete selection, but you can never read such a thing, right? The issue is that this annotation raises warnings for safe code that reads the selection and tries to use its values after checking that the selection itself isn't nil.

Not sure how to solve this though unless setting the selection was moved to a function and the field itself was made read-only, but maybe it would be better to allow false positive warnings for the case when you are assigning an incomplete table instead, I assume this is used less in practice.

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