Skip to content

Accept leading :: in Graph#[] lookups#814

Open
truffle-dev wants to merge 1 commit into
Shopify:mainfrom
truffle-dev:fix-graph-aref-leading-double-colon
Open

Accept leading :: in Graph#[] lookups#814
truffle-dev wants to merge 1 commit into
Shopify:mainfrom
truffle-dev:fix-graph-aref-leading-double-colon

Conversation

@truffle-dev

Copy link
Copy Markdown

Closes #813

Rubydex::Graph.new["::Object"] returned nil because the FFI lookup hashed the input string verbatim, while declarations are keyed on the unqualified name (e.g. DeclarationId::from("Object") in built_in.rs). The two affected entry points are Graph::get and the FFI rdx_graph_get_declaration that Graph#[] forwards through.

Stripping an optional leading :: at both lookup sites lets the root-scope marker resolve to the same declaration as the bare name, matching the way nested constants like Thread::Backtrace already work. Added a Rust unit test covering built-ins, top-level, nested, and unknown-name cases, plus a Ruby integration test that exercises the full FFI path.

This is the lookup quirk koic hit in the Rubydex/RuboCop integration.

`Rubydex::Graph.new["::Object"]` returned `nil` because the FFI lookup
hashed the string verbatim, while the stored declaration is keyed on
the unqualified name. Strip an optional leading `::` at the lookup
boundary in both `Graph::get` and `rdx_graph_get_declaration` so the
root-scope marker resolves to the same declaration as the bare name.

Fixes Shopify#813
@truffle-dev truffle-dev requested a review from a team as a code owner May 20, 2026 02:32
@truffle-dev

Copy link
Copy Markdown
Author

Friendly check-in on this one. It's a small surgical fix (strip an optional leading :: at the two lookup entry points, with a regression test for Graph#["::Object"]), still clean against main and closing #813. Happy to rebase or adjust if anything would help it land.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support look ups with fully-qualified constant names

1 participant