Skip to content

zig + dart: globals rule anchors ^[ \t]* so function-local var/const count as globals (+150% on the rosetta corpus) #2651

Closed

Description

@squid-protocol

Found by the #2560 rosetta classification sweep (zig #2607; ledger entry indented-declaration-globals already validates the shape for zig+dart, upstream_issue was null until now).

Cause

zig's (and dart's) globals rule anchors on ^[ \t]* — any line-start indentation — rather than true top-level scope. Function-local declarations therefore count as globals: zig corpus b.zig's 2 function-local vars and c.zig's function-local const all count alongside a.zig's 2 genuine top-level consts → globals 5 vs 2 planted (+150%).

Fix shape

Anchor top-levelness for real (column-0 only, or not-inside-a-function via the existing function-slice spans), for both zig and dart in one PR — the ledger entry names both as sharing the unanchored shape. Audit other brace-family languages' globals rules for the same ^[ \t]* anchor while there. Golden-master re-bless expected (globals counts drop wherever real repos declare locals with the same keywords).

Cause-key indented-declaration-globals; found via keyword-rosetta classification.

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

    bugcore-engine

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions