Skip to content

Stage struct fields used from sprites are still reported as unused #353

Description

@aspizu

Repro

tmp=$(mktemp -d /tmp/goboscript-stage-struct-used-sprite-XXXXXX)
printf 'costumes "blank.svg";\n\nstruct Point {\n    x,\n    y,\n}\n\nvar Point p = Point {\n    x: 1,\n    y: 2,\n};\n' > "$tmp/stage.gs"
printf 'costumes "blank.svg";\n\nonflag {\n    say p.x;\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 Point
warning: unused struct field x (never read)
warning: unused struct field y (never read)

p.x is read by the sprite script, but the stage struct and x field are still reported unused.

Expected

References from sprite scripts to stage/global struct variables should mark the stage struct and accessed field as used. In this repro, Point and Point.x should not warn as unused.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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