Fix signature lookup through prepended methods - #2706
Open
KaanOzkan wants to merge 1 commit into
Open
Conversation
KaanOzkan
force-pushed
the
ko-fix-prepended-method-signatures
branch
2 times, most recently
from
August 25, 2026 18:19
f7dbd97 to
f141140
Compare
amomchilov
reviewed
Aug 25, 2026
Comment on lines
+136
to
+139
| # Looking up the original `Example#foo` evaluates its `sig`. Because `Wrapper` | ||
| # was prepended, Ruby now resolves `Example#foo` to `Wrapper#foo`, so Sorbet | ||
| # stores the signature for `Wrapper#foo`. The first pass causes the store; the | ||
| # second pass finds `Example#foo`'s signature on `Wrapper#foo`. |
Contributor
There was a problem hiding this comment.
This comment is too hard-coded to the prepend case, but this implementation doesn't do anything to limit to prepended modules (and it's surprisingly difficult to identify them)
Contributor
Author
There was a problem hiding this comment.
Added a precursor to the comment, wdyt?
| current_method = current_method.super_method | ||
| end | ||
|
|
||
| return nil if pass.zero? && !T::Utils.signature_for_method(method) |
Contributor
Author
There was a problem hiding this comment.
I wanted to make it faster in the normal case and return early, new version should be easier to understand
KaanOzkan
force-pushed
the
ko-fix-prepended-method-signatures
branch
from
August 25, 2026 19:29
f141140 to
dfe8fab
Compare
KaanOzkan
marked this pull request as ready for review
August 25, 2026 19:33
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.
Motivation
Resolves #2705
Implementation
Go upto 2 levels to find a signature from the parent function if we can't find a signature in the original method
Tests
Currently testing it fully on Core, already observed that this particular test case is fixed