[ty] Infer the extra_items keyword argument to class-based TypedDicts as an annotation expression#24362
Conversation
Typing conformance results improved 🎉The percentage of diagnostics emitted that were expected errors increased from 86.76% to 86.79%. The percentage of expected errors that received a diagnostic increased from 81.53% to 81.72%. The number of fully passing files held steady at 70/132. SummaryHow are test cases classified?Each test case represents one expected error annotation or a group of annotations sharing a tag. Counts are per test case, not per diagnostic — multiple diagnostics on the same line count as one. Required annotations (
Test file breakdown1 file altered
True positives added (2)2 diagnostics
|
Memory usage reportMemory usage unchanged ✅ |
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-await |
40 | 0 | 0 |
invalid-return-type |
1 | 0 | 0 |
| Total | 41 | 0 | 0 |
Changes in flaky projects detected. Raw diff output excludes flaky projects; see the HTML report for details.
f3fc283 to
c8adbca
Compare
…ts as an annotation expression
814e002 to
a463cc7
Compare
* main: Document adding fixes in CONTRIBUTING.md (#24393) Sort formatter diagnostics in snapshots (#24375) [`pyupgrade`] Fix panic caused by handling of octals in `UP012` (#24390) Upgrade to nix v0.31.2 (#24385) Strip form feeds from indent passed to `dedent_to` (#24381) add recent move of the `deferred` submodule to `.git-blame-ignore-revs` (#24379) [ty] Fix extra_items TypedDict tests (#24367) [ty] Use `infer_type_expression` for validating PEP-613 type aliases (#24370) [`flake8-simplify`] Make the fix for `collapsible-if` (`SIM102`) safe in `preview` (#24371) [ty] Validate TypedDict fields when subclassing (#24338) [ty] pass type context to sequence literals in binary operations (#24197) Add release environment to notify-dependents job (#24372) Bump 0.15.9 (#24369) [ty] Move the `deferred` submodule inside `infer/builder` (#24368) [ty] Infer the `extra_items` keyword argument to class-based TypedDicts as an annotation expression (#24362) [ty] Validate type qualifiers in functional TypedDict fields and the `extra_items` keyword to functional TypedDicts (#24360)
…Concatenate Bumps ruff submodule to pull in astral-sh/ruff main through ty 0.0.31 (openrewrite/ruff ty-types-2 tip 1f844143e8). API shim changes: - ProjectDatabase::new → ProjectDatabase::fallible; the constructor now takes a MisconfigurationStrategy, and `fallible` matches our prior error-propagating behavior. - ClassLiteral gained DynamicTypedDict / DynamicEnum variants; replace the per-variant match in supertypes_from_class_literal with the uniform ClassLiteral::explicit_bases(db), which already handles them. - Type gained a Divergent(DivergentType) cycle marker; folded into the Other fallback alongside DataclassDecorator / BoundSuper. New wire-protocol fields on ParameterInfo: - concatenatePrefix (bool) — set on leading positional params of a Concatenate[T1, ..., Tn, P] / Concatenate[T1, ..., Tn, ...] signature. - paramSpecName (string) — set on the synthesized *args / **kwargs entries that stand in for a ParamSpec tail, carrying that ParamSpec's name. Both fields are omitted when absent, so consumers that ignore unknown fields see no change. TypedDict.extraItems is noted as a TODO in registry.rs: ty's inference-side parsing landed in astral-sh/ruff#24362, but the public accessor on TypedDictType is still unavailable.
…Concatenate (#14) * Update ruff submodule to latest ty-types-2 branch; surface ParamSpec/Concatenate Bumps ruff submodule to pull in astral-sh/ruff main through ty 0.0.31 (openrewrite/ruff ty-types-2 tip 1f844143e8). API shim changes: - ProjectDatabase::new → ProjectDatabase::fallible; the constructor now takes a MisconfigurationStrategy, and `fallible` matches our prior error-propagating behavior. - ClassLiteral gained DynamicTypedDict / DynamicEnum variants; replace the per-variant match in supertypes_from_class_literal with the uniform ClassLiteral::explicit_bases(db), which already handles them. - Type gained a Divergent(DivergentType) cycle marker; folded into the Other fallback alongside DataclassDecorator / BoundSuper. New wire-protocol fields on ParameterInfo: - concatenatePrefix (bool) — set on leading positional params of a Concatenate[T1, ..., Tn, P] / Concatenate[T1, ..., Tn, ...] signature. - paramSpecName (string) — set on the synthesized *args / **kwargs entries that stand in for a ParamSpec tail, carrying that ParamSpec's name. Both fields are omitted when absent, so consumers that ignore unknown fields see no change. TypedDict.extraItems is noted as a TODO in registry.rs: ty's inference-side parsing landed in astral-sh/ruff#24362, but the public accessor on TypedDictType is still unavailable. * Apply cargo fmt
Summary
Reject illegal TypedDict classes such as
class TD(TypedDict, extra_items=42), and validate qualifiers passed toextra_items.Test Plan
mdtests updated and extended