Repository navigation
Conversation
ApiMap#inner_get_methods sorted store pins by name with Array#sort, which is unstable. Two pins with the same name, such as a workspace reopen of String#upcase and the core RBS one, came out in an order that depended on how many other methods the class had, so get_method_stack's first pin and the inferred type of 'a'.upcase flipped between String and Symbol when an unrelated method was added. Sort by name with the store index as a tie-breaker, so same-name pins keep the order the store returns them in (core, then gems, conventions, workspace and open files).
#354 is closing as a duplicate of castwide#1415, which also clears this finding.
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.
Claude: This PR was written by Claude Code on behalf of @apiology.
Problem
Adding an unrelated method changes what a reopened core method infers:
Inference, hover and typecheck results shift with code elsewhere in the class, as well as with gem pins. Within this repo, a
Float#-overload from bigdecimal makes master reportWrong argument type for Float#-: arg_0 expected BigDecimal, received Floatat lib/solargraph/api_map.rb:114.Solution
ApiMap#inner_get_methodsnow sorts by name with the store index as a tie-breaker, becauseArray#sortis unstable and was reordering same-name pins. Same-name pins keep store order: core, then gems, conventions, workspace.The new
sort_by.with_indexline has an ignore marker citing apiology/solargraph#354, Type block parameters of map.with_index. That PR clears theUnresolved call to nameerror it suppresses.Which pin should win between a workspace reopen and RBS is unchanged, and not decided here. apiology/solargraph#119, Fix swapped @param tags on Hash.new default-block params, apiology/solargraph#49, Integration test: 2026-08-04 and castwide/solargraph#1310, Rebind self in Class.new blocks; nested blocks inherit rebound binders each add a second identical
.sortforstore.get_methods(''). That sort needs the same change when they land.