Repository navigation
[ty] Handle dynamic classes in string annotations - #27883
Merged
Merged
Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 97.68%. The percentage of expected errors that received a diagnostic held steady at 93.44%. The number of fully passing files held steady at 109/136. |
Memory usage reportMemory usage unchanged ✅ |
|
charliermarsh
marked this pull request as ready for review
August 19, 2026 14:43
carljm
added a commit
that referenced
this pull request
Aug 19, 2026
…ype-form * origin/main: [ty] Fix dynamic-class diagnostic snapshot in string annotations (#27890) Lock `wrangler` for playground deployments (#27838) [ty] Dogfood standalone scripts with inline configuration (#27885) Annotate intentional release secret inheritance (#27887) [ty] Skip invalid subscript operands in string annotations (#27882) [ty] Handle dynamic classes in string annotations (#27883) Disable `npm` install scripts by default (#27837) Require wheels for Python tooling dependencies (#27861) Update dependency pytest to v9 (#27881)
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
Previously, creating a dynamic class inside a string annotation could panic because the call's AST node belongs to a separately parsed annotation rather than the enclosing module:
Dynamic classes normally retain a scope-relative AST node index as their identity. For calls parsed from string annotations, that index was missing or later resolved against the wrong AST.
We now anchor those calls to the enclosing string expression and record the call's relative source range. This preserves distinct class identities, points diagnostics at the actual call, and handles nested annotations without retaining absolute source positions.
Supersedes #27851.