Skip to content

Dicts evaluated at comptime miss their lookups at runtime #10038

Description

@niclas-ahden
app [main!] { pf: platform "test/fx/platform/main.roc" }

import pf.Stdout
import pf.Stdin

top_dict = Dict.single("a", "b") # Comptime-evaluated

main! = || {
    key = Stdin.line!() # Force runtime-evaluation

    match Dict.get(top_dict, key) {
        Ok(value) => Stdout.line!(value)
        Err(_) => Stdout.line!("missing")
    }
}

roc check and roc build both report no errors, but echo a | roc --no-cache main.roc prints:

missing

Expected: b.

Tested on NixOS, x86_64, Roc 1299a2ca8bbdf3fab1eb9ec65335df6b4fb5092d.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions