Skip to content

[ty] Fix dynamic-class diagnostic snapshot in string annotations - #27890

Merged
AlexWaygood merged 1 commit into
mainfrom
alex/fix-string-annotation-layout-conflict-mdtest
Aug 19, 2026
Merged

AlexWaygood merged 1 commit into
mainfrom
alex/fix-string-annotation-layout-conflict-mdtest

Conversation

@AlexWaygood

Copy link
Copy Markdown
Member

Summary

Fix the main CI failure caused by the interaction between #27883 and #27882.

#27883 added a regression test expecting an instance-layout-conflict diagnostic 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. Its Annotated[...] form also matches the reproducer in #27883's original PR description.

The revised test no longer expects an additional invalid-type-form diagnostic, because the annotation is now valid. The rule that invalid string-annotation operands must not be evaluated remains covered separately in annotations/invalid.md.

@astral-sh-bot astral-sh-bot Bot added the ty The ty type checker label Aug 19, 2026
@AlexWaygood AlexWaygood added the testing Related to testing Ruff or ty label Aug 19, 2026
@AlexWaygood
AlexWaygood marked this pull request as ready for review August 19, 2026 15:13
@AlexWaygood
AlexWaygood requested a review from a team as a code owner August 19, 2026 15:13
@AlexWaygood
AlexWaygood enabled auto-merge (squash) August 19, 2026 15:13
@AlexWaygood
AlexWaygood merged commit dadba8c into main Aug 19, 2026
54 of 56 checks passed
@AlexWaygood
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Related to testing Ruff or ty ty The ty type checker

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant