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 into
mainfrom
alex/dead-code
Mar 31, 2026
Merged

AlexWaygood merged 1 commit into
mainfrom
alex/dead-code

Conversation

@AlexWaygood

@AlexWaygood AlexWaygood commented Mar 31, 2026 •

Copy link
Copy Markdown
Member

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 (not for changelogs) ty The ty type checker labels Mar 31, 2026
@AlexWaygood AlexWaygood added internal An internal refactor or improvement (not for changelogs) ty The ty type checker 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

astral-sh-bot Bot commented Mar 31, 2026

Copy link
Copy Markdown

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

astral-sh-bot Bot commented Mar 31, 2026

Copy link
Copy Markdown

Memory usage report

Memory usage unchanged ✅

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

astral-sh-bot Bot commented Mar 31, 2026

Copy link
Copy Markdown

ecosystem-analyzer results

No diagnostic changes detected ✅

Full report with detailed diff (timing results)

@AlexWaygood AlexWaygood added testing Related to testing Ruff or ty and removed internal An internal refactor or improvement (not for changelogs) 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 or ty ty The ty type checker

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants