Repository navigation
[ty] Fix dynamic-class diagnostic snapshot in string annotations - #27890
Merged
AlexWaygood merged 1 commit intoAug 19, 2026
Merged
Conversation
AlexWaygood
marked this pull request as ready for review
August 19, 2026 15:13
AlexWaygood
enabled auto-merge (squash)
August 19, 2026 15:13
AlexWaygood
deleted the
alex/fix-string-annotation-layout-conflict-mdtest
branch
August 19, 2026 15:15
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
Fix the
mainCI failure caused by the interaction between #27883 and #27882.#27883 added a regression test expecting an
instance-layout-conflictdiagnostic from a dynamic-class call inside an invalid string-annotation subscript. #27882 intentionally stopped evaluating invalid subscript operands in string annotations, so the diagnostic disappeared and the snapshot assertion began failing.Move the dynamic-class call into valid
Annotated[int, type(...)]metadata and update the diagnostic snapshot.Why the test still serves its original purpose
The original test verifies that a diagnostic from dynamic-class creation inside a separately parsed string annotation highlights the actual
type(...)call and its incompatible bases, rather than the entire annotation. The revised test exercises the same string-annotation anchoring and source-range handling, and still snapshots both precise diagnostic locations. ItsAnnotated[...]form also matches the reproducer in #27883's original PR description.The revised test no longer expects an additional
invalid-type-formdiagnostic, because the annotation is now valid. The rule that invalid string-annotation operands must not be evaluated remains covered separately inannotations/invalid.md.