Skip to content

[ty] Add missing test case for inline functional TypedDict with an invalid type passed to the name parameter#24334

Merged
AlexWaygood merged 1 commit intomainfrom
alex/dead-code
Mar 31, 2026
Merged

[ty] Add missing test case for inline functional TypedDict with an invalid type passed to the name parameter#24334
AlexWaygood merged 1 commit intomainfrom
alex/dead-code

Conversation

@AlexWaygood
Copy link
Copy Markdown
Member

@AlexWaygood AlexWaygood commented Mar 31, 2026

I'm pretty sure this branch is unreachable following #24331

Currently no tests fail if you delete this branch:

} else if !name_type.is_assignable_to(db, KnownClass::Str.to_instance(db))
&& let Some(builder) = self.context.report_lint(&INVALID_ARGUMENT_TYPE, name_arg)
{
let mut diagnostic = builder.into_diagnostic(format_args!(
"Invalid argument to parameter `typename` of `TypedDict()`"
));
diagnostic.set_primary_message(format_args!(
"Expected `str`, found `{}`",
name_type.display(db)
));
}

This PR adds the missing test coverage

@AlexWaygood AlexWaygood added internal An internal refactor or improvement ty Multi-file analysis & type inference labels Mar 31, 2026
@AlexWaygood AlexWaygood added internal An internal refactor or improvement ty Multi-file analysis & type inference labels Mar 31, 2026
@astral-sh-bot astral-sh-bot bot requested a review from oconnor663 March 31, 2026 17:18
@AlexWaygood

This comment was marked as outdated.

@AlexWaygood AlexWaygood marked this pull request as draft March 31, 2026 17:19
@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot bot commented Mar 31, 2026

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 86.61%. The percentage of expected errors that received a diagnostic held steady at 81.56%. The number of fully passing files held steady at 70/132.

@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot bot commented Mar 31, 2026

Memory usage report

Memory usage unchanged ✅

… invalid type passed to the `name` parameter
@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot bot commented Mar 31, 2026

ecosystem-analyzer results

No diagnostic changes detected ✅

Full report with detailed diff (timing results)

@AlexWaygood AlexWaygood added testing Related to testing Ruff itself and removed internal An internal refactor or improvement labels Mar 31, 2026
@AlexWaygood AlexWaygood marked this pull request as ready for review March 31, 2026 17:23
@AlexWaygood AlexWaygood changed the title [ty] Remove dead code from infer/builder/typed_dict.rs [ty] Add missing test case for inline functional TypedDict with an invalid type passed to the name parameter Mar 31, 2026
@AlexWaygood AlexWaygood enabled auto-merge (squash) March 31, 2026 17:25
@AlexWaygood AlexWaygood merged commit 39c3636 into main Mar 31, 2026
47 checks passed
@AlexWaygood AlexWaygood deleted the alex/dead-code branch March 31, 2026 17:28
carljm added a commit that referenced this pull request Apr 1, 2026
* main:
  [ty] Add missing test case for inline functional TypedDict with an invalid type passed to the `name` parameter (#24334)
  [ty] Use `_cls` as argument name for `collections.namedtuple` (#24333)
  [ty] Emit diagnostic for functional TypedDict with non-literal name (#24331)
  Add `nested-string-quote-style` formatting option (#24312)
  `RUF010`: Mark fix as unsafe when it deletes a comment
  [ty] Fix semantic token classification for properties accessed on instances (#24065)
  publish installers to `/installers/ruff/latest` on the mirror (#24247)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Related to testing Ruff itself ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants