[ty] Fix panic where we would incorrectly consider overloads in another file as belonging to a function in the file being checked#21977
Merged
AlexWaygood merged 2 commits intomainfrom Feb 25, 2026
Conversation
Typing conformance resultsNo changes detected ✅ |
|
MichaReiser
reviewed
Dec 15, 2025
MichaReiser
reviewed
Dec 15, 2025
dhruvmanila
reviewed
Dec 15, 2025
074904f to
a108f30
Compare
…overloads in another file as belonging to a function in the file being checked
a108f30 to
33f80d6
Compare
Memory usage reportMemory usage unchanged ✅ |
52effa9 to
8eb223e
Compare
8eb223e to
04eb9ca
Compare
Member
Author
|
Sorry it took me such a while to address the review comments here! This is (finally) ready for another round of review. |
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.
Summary
Fixes astral-sh/ty#1867. In certain cases where a function definition has not yet been completed, we can end up associating overloads from a totally different function (in a totally different file) with the unfinished function in the file being checked. That then leads us to panic in other places that assume (reasonably) that a function's overloads will all always be defined in a single file.
This PR fixes the panic by adding more sanity checks to
OverloadLiteral::previous_overload().Test Plan
Added a regression test that causes us to panic on
main.