Accept leading :: in Graph#[] lookups#814
Open
truffle-dev wants to merge 1 commit into
Open
Conversation
`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
Author
|
Friendly check-in on this one. It's a small surgical fix (strip an optional leading |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #813
Rubydex::Graph.new["::Object"]returnednilbecause the FFI lookup hashed the input string verbatim, while declarations are keyed on the unqualified name (e.g.DeclarationId::from("Object")inbuilt_in.rs). The two affected entry points areGraph::getand the FFIrdx_graph_get_declarationthatGraph#[]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 likeThread::Backtracealready 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.