Skip to content

Unexpected behavior after List item retrieval #9209

@ennisj9

Description

@ennisj9

Only workaround I found was looping through list - weird things happen when list_get_unsafe() is called twice.

On the zig compiler:

Minimum Reproduction

app [main!] { pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.6/2BfGn4M9uWJNhDVeMghGeXNVDFijMfPsmmVeo6M4QjKX.tar.zst" }

import pf.Stdout

main! = |_args| {
    list = ["foo","bar"]
    foo = list.first().ok_or("")
    bar = list.last().ok_or("")
    Stdout.line!(foo.concat(bar))
    Ok({})
}

Result

Roc crashed: Str does not implement last

Expected behavior

foobar

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions