Skip to content

[ty] Add a new assert-type-unspellable-subtype diagnostic#22815

Merged
AlexWaygood merged 1 commit intomainfrom
alex/assert-type-precise
Jan 23, 2026
Merged

[ty] Add a new assert-type-unspellable-subtype diagnostic#22815
AlexWaygood merged 1 commit intomainfrom
alex/assert-type-precise

Conversation

@AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Jan 22, 2026

Fixes astral-sh/ty#1762. If a type assertion fails, but the actual type is an unspellable subtype of the asserted type, we now emit assert-type-unspellable-subtype rather than type-assertion-failure. We also ignore this error in scripts/conformance.py. This results in 17 fewer false positives on the conformance suite, and it's also something that our users have asked for.

@AlexWaygood AlexWaygood added the ty Multi-file analysis & type inference label Jan 22, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 22, 2026

Typing conformance results improved 🎉

The percentage of diagnostics emitted that were expected errors increased from 77.33% to 78.71%. The percentage of expected errors that received a diagnostic held steady at 69.23%.

Summary

Metric Old New Diff Outcome
True Positives 747 747 +0
False Positives 219 202 -17 ⏬ (✅)
False Negatives 332 332 +0
Total Diagnostics 966 949 -17
Precision 77.33% 78.71% +1.39% ⏫ (✅)
Recall 69.23% 69.23% +0.00%

False positives removed

Details
Location Name Message
annotations_generators.py:193:1 type-assertion-failure Type () -> AsyncIterator[int] does not match asserted type def generator30() -> AsyncIterator[int]
generics_defaults.py:30:1 type-assertion-failure Type type[NoNonDefaults[str, int]] does not match asserted type <class 'NoNonDefaults'>
generics_defaults.py:31:1 type-assertion-failure Type type[NoNonDefaults[str, int]] does not match asserted type <class 'NoNonDefaults[str, int]'>
generics_defaults.py:32:1 type-assertion-failure Type type[NoNonDefaults[str, int]] does not match asserted type <class 'NoNonDefaults[str, int]'>
generics_defaults.py:38:1 type-assertion-failure Type type[OneDefault[int | float, bool]] does not match asserted type <class 'OneDefault[int | float, bool]'>
generics_defaults.py:46:1 type-assertion-failure Type type[AllTheDefaults[int, int | float | complex, str, int, bool]] does not match asserted type <class 'AllTheDefaults[int, int | float | complex, str, int, bool]'>
generics_defaults.py:52:1 type-assertion-failure Type type[AllTheDefaults[int, int | float | complex, str, int, bool]] does not match asserted type <class 'AllTheDefaults[int, int | float | complex, str, int, bool]'>
generics_defaults.py:55:1 type-assertion-failure Type type[AllTheDefaults[int, int | float | complex, str, int, bool]] does not match asserted type <class 'AllTheDefaults[int, int | float | complex, str, int, bool]'>
generics_defaults.py:59:1 type-assertion-failure Type type[AllTheDefaults[int, int | float | complex, str, int, bool]] does not match asserted type <class 'AllTheDefaults[int, int | float | complex, str, int, bool]'>
generics_defaults.py:63:1 type-assertion-failure Type type[AllTheDefaults[int, int | float | complex, str, int, bool]] does not match asserted type <class 'AllTheDefaults[int, int | float | complex, str, int, bool]'>
generics_defaults.py:79:1 type-assertion-failure Type type[Class_ParamSpec[(str, int, /)]] does not match asserted type <class 'Class_ParamSpec'>
generics_defaults_referential.py:23:1 type-assertion-failure Type type[slice[int, int, int | None]] does not match asserted type <class 'slice'>
generics_defaults_referential.py:95:1 type-assertion-failure Type type[Bar[int, list[int]]] does not match asserted type <class 'Bar[int, list[int]]'>
generics_defaults_specialization.py:45:1 type-assertion-failure Type type[Bar[str]] does not match asserted type <class 'Bar'>
generics_syntax_scoping.py:116:13 type-assertion-failure Type TypeVar does not match asserted type TypeVar
narrowing_typeis.py:21:9 type-assertion-failure Type tuple[str, ...] does not match asserted type tuple[str, ...] & ~tuple[str, str]
narrowing_typeis.py:38:9 type-assertion-failure Type int does not match asserted type int & ~Awaitable[object]

@astral-sh-bot
Copy link

astral-sh-bot bot commented Jan 22, 2026

mypy_primer results

Changes were detected when running on open source projects
scipy-stubs (https://github.com/scipy/scipy-stubs)
- tests/sparse/test_csr.pyi:137:1: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[spmatrix[object] @ csr_arr]`
+ tests/sparse/test_csr.pyi:137:1: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[spmatrix[object] @ csr_arr]`
- tests/sparse/test_csr.pyi:138:1: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[spmatrix[object] @ csr_mat]`
+ tests/sparse/test_csr.pyi:138:1: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[spmatrix[object] @ csr_mat]`
- tests/sparse/test_csr.pyi:139:1: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[spmatrix[object]]`
+ tests/sparse/test_csr.pyi:139:1: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[spmatrix[object]]`
- tests/sparse/test_spbase.pyi:22:1: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[SparseABC @ coo_mat]`
+ tests/sparse/test_spbase.pyi:22:1: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[SparseABC @ coo_mat]`
- tests/sparse/test_spbase.pyi:23:1: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[SparseABC @ coo_arr]`
+ tests/sparse/test_spbase.pyi:23:1: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[SparseABC @ coo_arr]`
- tests/sparse/test_spbase.pyi:24:1: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[SparseABC @ i64_2d]`
+ tests/sparse/test_spbase.pyi:24:1: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[SparseABC @ i64_2d]`
- tests/sparse/test_spbase.pyi:26:1: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[csr_matrix[object] @ csr_mat]`
+ tests/sparse/test_spbase.pyi:26:1: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[csr_matrix[object] @ csr_mat]`
- tests/sparse/test_spbase.pyi:27:1: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[csc_matrix[object] @ csr_mat]`
+ tests/sparse/test_spbase.pyi:27:1: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[csc_matrix[object] @ csr_mat]`
- tests/sparse/test_spbase.pyi:29:1: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[SparseABC]`
+ tests/sparse/test_spbase.pyi:29:1: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[SparseABC]`

pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
- tests/test_api_types.py:23:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[builtins.bool | numpy.bool[builtins.bool] @ obj]`
+ tests/test_api_types.py:23:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[builtins.bool | numpy.bool[builtins.bool] @ obj]`
- tests/test_api_types.py:24:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[builtins.bool | numpy.bool[builtins.bool] @ nparr]`
+ tests/test_api_types.py:24:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[builtins.bool | numpy.bool[builtins.bool] @ nparr]`
- tests/test_api_types.py:25:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[builtins.bool | numpy.bool[builtins.bool] @ dtylike]`
+ tests/test_api_types.py:25:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[builtins.bool | numpy.bool[builtins.bool] @ dtylike]`
- tests/test_api_types.py:26:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[builtins.bool | numpy.bool[builtins.bool] @ arr]`
+ tests/test_api_types.py:26:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[builtins.bool | numpy.bool[builtins.bool] @ arr]`
- tests/test_api_types.py:27:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[builtins.bool | numpy.bool[builtins.bool] @ dframe]`
+ tests/test_api_types.py:27:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[builtins.bool | numpy.bool[builtins.bool] @ dframe]`
- tests/test_api_types.py:28:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[builtins.bool | numpy.bool[builtins.bool] @ ind]`
+ tests/test_api_types.py:28:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[builtins.bool | numpy.bool[builtins.bool] @ ind]`
- tests/test_api_types.py:44:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[int | float | complex @ obj]`
+ tests/test_api_types.py:44:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[int | float | complex @ obj]`
- tests/test_api_types.py:45:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[int | float | complex @ nparr]`
+ tests/test_api_types.py:45:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[int | float | complex @ nparr]`
- tests/test_api_types.py:46:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[int | float | complex @ dtylike]`
+ tests/test_api_types.py:46:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[int | float | complex @ dtylike]`
- tests/test_api_types.py:47:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[int | float | complex @ arr]`
+ tests/test_api_types.py:47:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[int | float | complex @ arr]`
- tests/test_api_types.py:49:9: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[int | float | complex @ dframe]`
+ tests/test_api_types.py:49:9: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[int | float | complex @ dframe]`
- tests/test_api_types.py:52:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[int | float | complex @ ind]`
+ tests/test_api_types.py:52:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[int | float | complex @ ind]`
- tests/test_api_types.py:144:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[int | float | floating[Any] @ obj]`
+ tests/test_api_types.py:144:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[int | float | floating[Any] @ obj]`
- tests/test_api_types.py:145:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[int | float | floating[Any] @ nparr]`
+ tests/test_api_types.py:145:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[int | float | floating[Any] @ nparr]`
- tests/test_api_types.py:146:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[int | float | floating[Any] @ dtylike]`
+ tests/test_api_types.py:146:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[int | float | floating[Any] @ dtylike]`
- tests/test_api_types.py:147:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[int | float | floating[Any] @ arr]`
+ tests/test_api_types.py:147:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[int | float | floating[Any] @ arr]`
- tests/test_api_types.py:148:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[int | float | floating[Any] @ dframe]`
+ tests/test_api_types.py:148:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[int | float | floating[Any] @ dframe]`
- tests/test_api_types.py:149:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[int | float | floating[Any] @ ind]`
+ tests/test_api_types.py:149:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[int | float | floating[Any] @ ind]`
- tests/test_api_types.py:177:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[int | integer[Any] @ obj]`
+ tests/test_api_types.py:177:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[int | integer[Any] @ obj]`
- tests/test_api_types.py:178:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[int | integer[Any] @ nparr]`
+ tests/test_api_types.py:178:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[int | integer[Any] @ nparr]`
- tests/test_api_types.py:179:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[int | integer[Any] @ dtylike]`
+ tests/test_api_types.py:179:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[int | integer[Any] @ dtylike]`
- tests/test_api_types.py:180:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[int | integer[Any] @ arr]`
+ tests/test_api_types.py:180:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[int | integer[Any] @ arr]`
- tests/test_api_types.py:182:9: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[int | integer[Any] @ dframe]`
+ tests/test_api_types.py:182:9: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[int | integer[Any] @ dframe]`
- tests/test_api_types.py:185:11: error[type-assertion-failure] Type `bool` does not match asserted type `TypeGuard[int | integer[Any] @ ind]`
+ tests/test_api_types.py:185:11: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeGuard[int | integer[Any] @ ind]`
- tests/test_pandas.py:493:18: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[NaTType | NAType | None @ pd.NA]`
+ tests/test_pandas.py:493:18: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[NaTType | NAType | None @ pd.NA]`
- tests/test_pandas.py:494:22: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[str | bytes | date | ... omitted 9 union elements @ pd.NA]`
+ tests/test_pandas.py:494:22: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[str | bytes | date | ... omitted 9 union elements @ pd.NA]`
- tests/test_pandas.py:496:18: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[NaTType | NAType | None @ pd.NaT]`
+ tests/test_pandas.py:496:18: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[NaTType | NAType | None @ pd.NaT]`
- tests/test_pandas.py:497:22: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[str | bytes | date | ... omitted 9 union elements @ pd.NaT]`
+ tests/test_pandas.py:497:22: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[str | bytes | date | ... omitted 9 union elements @ pd.NaT]`
- tests/test_pandas.py:499:18: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[NaTType | NAType | None]`
+ tests/test_pandas.py:499:18: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[NaTType | NAType | None]`
- tests/test_pandas.py:500:22: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[str | bytes | date | ... omitted 9 union elements]`
+ tests/test_pandas.py:500:22: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[str | bytes | date | ... omitted 9 union elements]`
- tests/test_pandas.py:502:22: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[NaTType | NAType | None]`
+ tests/test_pandas.py:502:22: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[NaTType | NAType | None]`
- tests/test_pandas.py:503:18: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[float]`
+ tests/test_pandas.py:503:18: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[float]`
- tests/test_pandas.py:507:18: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[datetime @ py_dt]`
+ tests/test_pandas.py:507:18: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[datetime @ py_dt]`
- tests/test_pandas.py:508:22: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[NaTType | NAType | None @ py_dt]`
+ tests/test_pandas.py:508:22: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[NaTType | NAType | None @ py_dt]`
- tests/test_pandas.py:511:18: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[timedelta @ py_td]`
+ tests/test_pandas.py:511:18: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[timedelta @ py_td]`
- tests/test_pandas.py:512:22: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[NaTType | NAType | None @ py_td]`
+ tests/test_pandas.py:512:22: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[NaTType | NAType | None @ py_td]`
- tests/test_pandas.py:515:18: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[datetime64[date | int | None] @ np_dt]`
+ tests/test_pandas.py:515:18: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[datetime64[date | int | None] @ np_dt]`
- tests/test_pandas.py:516:22: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[NaTType | NAType | None @ np_dt]`
+ tests/test_pandas.py:516:22: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[NaTType | NAType | None @ np_dt]`
- tests/test_pandas.py:519:18: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[timedelta64[timedelta & ~NaTType & ~NAType] @ np_td]`
+ tests/test_pandas.py:519:18: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[timedelta64[timedelta & ~NaTType & ~NAType] @ np_td]`
- tests/test_pandas.py:520:22: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[NaTType | NAType | None @ np_td]`
+ tests/test_pandas.py:520:22: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[NaTType | NAType | None @ np_td]`
- tests/test_pandas.py:523:18: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[NaTType | NAType | None @ np_nat]`
+ tests/test_pandas.py:523:18: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[NaTType | NAType | None @ np_nat]`
- tests/test_pandas.py:524:22: error[type-assertion-failure] Type `bool` does not match asserted type `TypeIs[str | bytes | date | ... omitted 9 union elements @ np_nat]`
+ tests/test_pandas.py:524:22: error[assert-type-unspellable-subtype] Type `bool` does not match asserted type `TypeIs[str | bytes | date | ... omitted 9 union elements @ np_nat]`

rotki (https://github.com/rotki/rotki)
+ rotkehlchen/chain/decoding/tools.py:96:44: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- rotkehlchen/chain/decoding/tools.py:97:13: error[invalid-argument-type] Argument to function `decode_transfer_direction` is incorrect: Expected `BTCAddress | ChecksumAddress | SubstrateAddress | SolanaAddress`, found `A@BaseDecoderTools`
+ rotkehlchen/chain/decoding/tools.py:99:13: error[invalid-argument-type] Argument to function `decode_transfer_direction` is incorrect: Expected `Sequence[A@BaseDecoderTools]`, found `Unknown | tuple[BTCAddress, ...] | tuple[ChecksumAddress, ...] | tuple[SubstrateAddress, ...] | tuple[SolanaAddress, ...]`
- rotkehlchen/chain/decoding/tools.py:98:13: error[invalid-argument-type] Argument to function `decode_transfer_direction` is incorrect: Expected `BTCAddress | ChecksumAddress | SubstrateAddress | SolanaAddress | None`, found `A@BaseDecoderTools | None`
+ rotkehlchen/chain/decoding/tools.py:100:62: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 2049 diagnostics
+ Found 2050 diagnostics

No memory usage changes detected ✅

@AlexWaygood AlexWaygood force-pushed the alex/assert-type-precise branch 2 times, most recently from 2ffecd3 to 93c0c4b Compare January 22, 2026 21:11
@AlexWaygood AlexWaygood marked this pull request as ready for review January 22, 2026 21:14
@AlexWaygood
Copy link
Member Author

(I do think that the ideal state is to get the typing conformance suite to a place where it uses fewer assert_type calls, and instead uses alternative mechanisms to test the behaviour of type checkers. But the error code seems like a good one to add anyway, and I think ignoring the new error code when running the conformance tests is a reasonable short-term measure.)

@astral-sh-bot

This comment was marked as off-topic.

pub(crate) static ASSERT_TYPE_UNSPELLABLE_SUBTYPE = {
summary: "detects failed type assertions",
status: LintStatus::stable("0.0.14"),
default_level: Level::Error,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a warning by default, given that this is only a suspicious pattern?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should still be an error — the assertion is still failing. The spec says that assert_type should only pass if the two types are equivalent, and we only emit this error if the two types are not equivalent

@AlexWaygood AlexWaygood force-pushed the alex/assert-type-precise branch from 93c0c4b to 67b2237 Compare January 23, 2026 18:44
@AlexWaygood
Copy link
Member Author

I feel confident that splitting this into two error codes is an improvement. I'm less confident that it's appropriate to ignore the new error code when we run the conformance script (or if it'll be okay to publish results upstream with the new error code ignored). But that part is easy to revert/revisit later; it's just a one-line change to the Python script.

@AlexWaygood AlexWaygood merged commit fcbf6f1 into main Jan 23, 2026
49 checks passed
@AlexWaygood AlexWaygood deleted the alex/assert-type-precise branch January 23, 2026 21:16
carljm added a commit that referenced this pull request Jan 30, 2026
* main: (62 commits)
  [`refurb`] Do not add `abc.ABC` if already present (`FURB180`) (#22234)
  [ty] Add a new `assert-type-unspellable-subtype` diagnostic (#22815)
  [ty] Avoid duplicate syntax errors for `await` outside functions (#22826)
  [ty] Fix unary operator false-positive for constrained TypeVars (#22783)
  [ty] Fix binary operator false-positive for constrained TypeVars (#22782)
  [ty] Fix false-positive `unsupported-operator` for "symmetric" TypeVars (#22756)
  [`pydocstyle`] Clarify which quote styles are allowed (`D300`) (#22825)
  [ty] Use distributed versions of AND and OR on constraint sets (#22614)
  [ty] Add support for dict literals and dict() calls as default values for parameters with TypedDict types (#22161)
  Document `-` stdin convention in CLI help text (#22817)
  [ty] Make `infer_subscript_expression_types` a method on `Type` (#22731)
  [ty] Simplify `OverloadLiteral::spans` and `OverloadLiteral::parameter_span` (#22823)
  [ty] Require both `*args` and `**kwargs` when calling a `ParamSpec` callable (#22820)
  [ty] Handle tagged errors in conformance (#22746)
  Add `--color` cli option to force colored output (#22806)
  Identify notebooks by LSP didOpen instead of `.ipynb` file extension (#22810)
  [ty] Fix docstring rendering for literal blocks after doctests (#22676)
  [ty] Update salsa to fix out-of-order query validation (#22498)
  [ty] Inline cycle initial and recovery functions (#22814)
  [ty] Pass the generic context through the decorator (#22544)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type type[str] does not match asserted type <class 'str'>

3 participants