Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected symbol plume.Scatter.56 to have a layout. #7461

Open
lukewilliamboswell opened this issue Jan 4, 2025 · 3 comments
Open

Expected symbol plume.Scatter.56 to have a layout. #7461

lukewilliamboswell opened this issue Jan 4, 2025 · 3 comments
Assignees
Labels
bug Something isn't working P-high High priority/frequency

Comments

@lukewilliamboswell
Copy link
Collaborator

I've removed all extraneous code that I think I can, and pushed to a minimal branch https://github.com/lukewilliamboswell/plume/tree/bug-1

16:07:23 ~/Documents/GitHub/plume bug-1 $ ../roc/target/debug/roc examples/bar-chart.roc
thread 'main' panicked at crates/compiler/mono/src/reset_reuse.rs:1244:42:
Expected symbol `plume.Scatter.56` to have a layout. It should have been inserted in the environment already.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This is a strange bug that I haven't been able to understand... 🤷‍♂️ 😕

@lukewilliamboswell lukewilliamboswell added the bug Something isn't working label Jan 4, 2025
@lukewilliamboswell
Copy link
Collaborator Author

lukewilliamboswell commented Jan 5, 2025

This repro's on current main commit c85c864b5fe29e2114c0e02d00388b731d99b70a for me still

$ cargo run -- test bug.roc
    Finished dev [unoptimized + debuginfo] target(s) in 0.46s
     Running `target/debug/roc test bug.roc`
thread 'main' panicked at crates/compiler/mono/src/reset_reuse.rs:1244:42:
Expected symbol to have a layout. It should have been inserted in the environment already.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
module []

expect

    _ =
        when new_scatter { data : []} is
            Ok asdf -> scatter_to_str asdf
            Err _ -> crash ""

    1 == 2


Trace x y := {
    data : List { x : x, y : y },
    orientation : [Vertical, Horizontal],
    name : Str,
    marker : Marker,
}
    implements [Inspect]

new_scatter :
    {
        data : List { x : x, y : y },
        orientation ? [Vertical, Horizontal],
        name ? Str,
    }
    -> Result (Trace x y) _
new_scatter = \{ data, orientation ? Vertical, name ? ""} ->
    Ok
        (
            @Trace {
                data,
                orientation,
                name,
                marker: new_marker? {},
            }
        )

# CHANING ANYHTING IN HERE SEEMS TO "FIX" IT
scatter_to_str : Trace x y -> Str where x implements Inspect, y implements Inspect
scatter_to_str = \@Trace inner ->

    # NOT USED ... BUT WE CAN"T REMOVE, OR BUG GOES AWAY??
    data2 = List.walk inner.data ([], []) \(xs, ys), { x, y } -> (List.append xs x, List.append ys y)

    # NOT USED ... BUT WE CAN"T REMOVE, OR BUG GOES AWAY??
    orientation_str = if inner.orientation == Vertical then "\"orientation\":\"v\"" else "\"orientation\":\"h\""

    # NOT USED ... BUT WE CAN"T REMOVE, OR BUG GOES AWAY??
    name_str = if Str.isEmpty inner.name then "" else "\"name\":\"$(inner.name)\""

    # NOT USED ... BUT WE CAN"T REMOVE, OR BUG GOES AWAY??
    marker_str = marker_to_str inner.marker

    ""


Marker := {}
    implements [Inspect]

new_marker : {} -> Result Marker _
new_marker = \{} -> Ok (@Marker {})

marker_to_str : Marker -> Str
marker_to_str = \_ -> ""

@Anton-4
Copy link
Collaborator

Anton-4 commented Jan 23, 2025

I'm also hitting this on the weaver snake_case branch smores56/weaver@0059085 with roc version:

❯ roc version
roc nightly pre-release, built from commit c5a4644 on Do 23 Jan 2025 09:02:04 UTC
❯ roc test package/main.roc
thread 'main' panicked at crates/compiler/mono/src/reset_reuse.rs:1244:42:
Expected symbol to have a layout. It should have been inserted in the environment already.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@Anton-4 Anton-4 self-assigned this Jan 23, 2025
@Anton-4
Copy link
Collaborator

Anton-4 commented Jan 23, 2025

It's in wasm4 too: lukewilliamboswell/roc-wasm4#32 (comment)

@Anton-4 Anton-4 added the P-high High priority/frequency label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P-high High priority/frequency
Projects
None yet
Development

No branches or pull requests

2 participants