Skip to content

Unexpected behaviour - cannot slice unkown with ?. #822

@mdmcconnell

Description

@mdmcconnell

I wouldn't say that this is a bug, but an unexpected behaviour I have come across:

let x = "test"; x?.[0:1]

Returns "t", as expected.

let x = nil; x?.[0:1]

Returns "error cannot slice unknown (1:17)". I expected nil.

Possibly the first expression is misuse of the langauge and should not be allowed. But if it is to be allowed, then I think the consistent result of the second expression should be nil.

Metadata

Metadata

Assignees

No one assigned

    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