Skip to content

show/hide monitor statements do not mark struct fields as used #357

@aspizu

Description

@aspizu

Repro

tmp=$(mktemp -d /tmp/goboscript-show-unused-XXXXXX)
printf 'costumes "blank.svg";\n\n' > "$tmp/stage.gs"
printf 'costumes "blank.svg";\n\nstruct Pair { x, y }\nvar Pair p = Pair { x: 1, y: 2 };\n\nonflag {\n    show p;\n}\n' > "$tmp/main.gs"
printf '<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"></svg>\n' > "$tmp/blank.svg"
cargo run --quiet -- build "$tmp"

Observed:

warning: unused struct Pair
warning: unused struct field x (never read)
warning: unused struct field y (never read)

show p; expands to monitor operations for p.x and p.y, but reference marking ignores Stmt::Show/Stmt::Hide, so the struct and fields are still reported unused.

Expected

show/hide statements should count as uses of the variable/list they target. For struct values, expanded monitor statements should mark the struct and generated fields as used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions