fix Exception message for incorrect dict literal is too wide #893#2330
fix Exception message for incorrect dict literal is too wide #893#2330asukaminato0721 wants to merge 5 commits into
Conversation
|
There was a problem hiding this comment.
Pull request overview
This PR fixes issue #893 by narrowing dict literal type mismatch errors to point at the specific problematic key, value, or unpacked mapping instead of the entire dict literal. This improves the developer experience by making it easier to identify which element in a dict literal is causing a type error.
Changes:
- Added
dict_literal_error_rangefunction to identify the first mismatching element in a dict literal - Added test case to verify error ranges point to the specific value causing the error
- Integrated the new function into the type checking flow to provide narrowed error ranges
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| pyrefly/lib/alt/expr.rs | Implements dict_literal_error_range function that re-infers dict elements to find the first type mismatch and integrates it into type checking |
| pyrefly/lib/test/dict.rs | Adds test case verifying that dict literal errors point to the specific incorrect value |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #[test] | ||
| fn test_dict_literal_error_range_points_to_value() { | ||
| util::init_test(); | ||
| let code = r#"x: dict[str, str] = { | ||
| "1": 2, | ||
| } | ||
| "#; | ||
| let (handle, state) = util::mk_state(code); | ||
| let errors = state | ||
| .transaction() | ||
| .get_errors([&handle]) | ||
| .collect_errors() | ||
| .shown; | ||
| assert_eq!(errors.len(), 1); | ||
| let err = &errors[0]; | ||
| let value_offset = code.find("2").expect("missing dict value literal"); | ||
| let expected_start = TextSize::try_from(value_offset).unwrap(); | ||
| assert_eq!(err.range().start(), expected_start); | ||
| } |
There was a problem hiding this comment.
The test only covers the case where the value type is wrong. Consider adding additional test cases to cover: 1) when the key type is wrong, 2) when both key and value types are wrong (should point to key as it's checked first), 3) when an unpacked dict has incompatible types, and 4) when there are multiple errors in the dict but only the first one should be reported.
| let err = &errors[0]; | ||
| let value_offset = code.find("2").expect("missing dict value literal"); | ||
| let expected_start = TextSize::try_from(value_offset).unwrap(); | ||
| assert_eq!(err.range().start(), expected_start); |
There was a problem hiding this comment.
The test only checks that the error starts at the correct position but doesn't verify the end position of the error range. Consider also asserting on the end position to ensure the error range only covers the problematic value (the literal "2") and not additional characters.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
rchen152
left a comment
There was a problem hiding this comment.
Do you know why the mypy_primer results changed? That seems concerning to me; I wouldn't expect an improvement to an error message to affect what errors are reported.
This comment has been minimized.
This comment has been minimized.
|
In dict_items_infer we call check_type on each key/value and record those errors on the item ranges. That can increase the count and change message text For example, this shows the range is smaller. - ERROR static_frame/test/unit/test_frame.py:1007:43-62
+ ERROR static_frame/test/unit/test_frame.py:1007:44-45In multiline dicts, the error now lands on the offending key/value line, not on the assignment line. Any # type: ignore or pyrefly suppression on the assignment line no longer applies, so extra errors appear. |
rchen152
left a comment
There was a problem hiding this comment.
Sorry for the delay in getting you a more in-depth review of this PR. The mypy_primer change being caused by the error range changing makes sense, thanks.
This comment has been minimized.
This comment has been minimized.
|
well, this is a bit ... verbose but more precise. |
This comment has been minimized.
This comment has been minimized.
rchen152
left a comment
There was a problem hiding this comment.
Thanks! This looks like a more promising direction.
Some of the new errors in mypy_primer look like false positives. For example, there's a new error at https://github.com/scrapy/scrapy/blob/ccfa052fa19f712355fb17b863e8ff77f34ff3ac/scrapy/downloadermiddlewares/cookies.py#L188C1-L188C76 but no corresponding old error or # type: ignore. Looking at the signature of Response.__init__: https://github.com/scrapy/scrapy/blob/ccfa052fa19f712355fb17b863e8ff77f34ff3ac/scrapy/http/response/__init__.py#L63, we seem to be matching the headers argument against Iterable[tuple[AnyStr, Any]] and not considering the other options in the union.
I'm suspicious that this may be due to a preexisting bug in how union hints are decomposed (#793). Maybe we need to exclude union hints from this new logic until that bug has been resolved.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Diff from mypy_primer, showing the effect of this PR on open source code: rotki (https://github.com/rotki/rotki)
- ERROR rotkehlchen/chain/aggregator.py:345:129-348:10: `dict[SupportedBlockchain, (self: Self@ChainsAggregator, blockchain: SUPPORTED_SUBSTRATE_CHAINS_TYPE, append_or_remove: Literal['append', 'remove']) -> None]` is not assignable to attribute `chain_modify_init` with type `dict[SupportedBlockchain, (SupportedBlockchain, Literal['append', 'remove']) -> None]` [bad-assignment]
- ERROR rotkehlchen/chain/aggregator.py:349:121-351:10: `dict[SupportedBlockchain, (self: Self@ChainsAggregator, blockchain: Literal[SupportedBlockchain.ETHEREUM], address: ChecksumAddress) -> None]` is not assignable to attribute `chain_modify_append` with type `dict[SupportedBlockchain, (SupportedBlockchain, BlockchainAddress) -> None]` [bad-assignment]
- ERROR rotkehlchen/chain/aggregator.py:352:121-354:10: `dict[SupportedBlockchain, (self: Self@ChainsAggregator, blockchain: Literal[SupportedBlockchain.ETHEREUM], address: ChecksumAddress) -> None]` is not assignable to attribute `chain_modify_remove` with type `dict[SupportedBlockchain, (SupportedBlockchain, BlockchainAddress) -> None]` [bad-assignment]
+ ERROR rotkehlchen/tests/api/test_history_base_entry.py:1433:36-37: `int` is not assignable to `str` [bad-assignment]
jax (https://github.com/google/jax)
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/cpu_triangular_solve_blas_trsm.py:119:12-125:73: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]], ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` [bad-assignment]
- ERROR jax/_src/internal_test_util/export_back_compat_test_data/cpu_triangular_solve_blas_trsm.py:114:26-151:2: Cannot set item in `dict[str, dict[str, bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]]]` [unsupported-operation]
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/cpu_triangular_solve_blas_trsm.py:126:22-133:65: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` [bad-assignment]
- ERROR jax/_src/internal_test_util/export_back_compat_test_data/cpu_tridiagonal_solve_lapack_gtsv.py:158:26-233:2: Cannot set item in `dict[str, dict[str, bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]]]` [unsupported-operation]
- ERROR jax/_src/internal_test_util/export_back_compat_test_data/cuda_cholesky_solver_potrf.py:160:26-231:2: Cannot set item in `dict[str, dict[str, bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]]]` [unsupported-operation]
- ERROR jax/_src/internal_test_util/export_back_compat_test_data/cuda_eigh_cusolver_syev.py:183:26-271:2: Cannot set item in `dict[str, dict[str, bytes | date | int | list[str] | str | tuple[()] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]]]` [unsupported-operation]
- ERROR jax/_src/internal_test_util/export_back_compat_test_data/cuda_lu_cusolver_getrf.py:115:26-157:2: Cannot set item in `dict[str, dict[str, bytes | date | int | list[str] | str | tuple[()] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit]]]]]]` [unsupported-operation]
- ERROR jax/_src/internal_test_util/export_back_compat_test_data/cuda_qr_cusolver_geqrf.py:158:26-218:2: Cannot set item in `dict[str, dict[str, bytes | date | int | list[str] | str | tuple[()] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]]]` [unsupported-operation]
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/cpu_tridiagonal_solve_lapack_gtsv.py:163:12-189:55: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]], ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]], ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]], ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` [bad-assignment]
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/cpu_tridiagonal_solve_lapack_gtsv.py:190:22-206:60: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` [bad-assignment]
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/cuda_cholesky_solver_potrf.py:165:12-172:77: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` [bad-assignment]
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/cuda_cholesky_solver_potrf.py:173:22-181:25: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` [bad-assignment]
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/cuda_eigh_cusolver_syev.py:189:22-197:22: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[()] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` [bad-assignment]
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/cuda_lu_cusolver_getrf.py:121:22-123:130: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[()] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit]]]]` [bad-assignment]
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/cuda_qr_cusolver_geqrf.py:164:22-178:24: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]], ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[()] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` [bad-assignment]
- ERROR jax/_src/internal_test_util/export_back_compat_test_data/cuda_svd_cusolver_gesvd.py:187:36-283:2: Cannot set item in `dict[str, dict[str, bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]]]` [unsupported-operation]
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/cuda_svd_cusolver_gesvd.py:192:12-209:25: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` [bad-assignment]
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/cuda_svd_cusolver_gesvd.py:210:22-245:24: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` [bad-assignment]
- ERROR jax/_src/internal_test_util/export_back_compat_test_data/cuda_tridiagonal_cusolver_sytrd.py:182:26-269:2: Cannot set item in `dict[str, dict[str, bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]]]` [unsupported-operation]
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/cuda_tridiagonal_cusolver_sytrd.py:187:12-204:25: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` [bad-assignment]
- ERROR jax/_src/internal_test_util/export_back_compat_test_data/gpu_eigh_solver_syev.py:271:26-406:2: Cannot set item in `dict[str, dict[str, bytes | date | int | list[str] | str | tuple[()] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]]]` [unsupported-operation]
- ERROR jax/_src/internal_test_util/export_back_compat_test_data/rocm_cholesky_solver_potrf.py:160:26-231:2: Cannot set item in `dict[str, dict[str, bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]]]` [unsupported-operation]
- ERROR jax/_src/internal_test_util/export_back_compat_test_data/rocm_lu_rocsolver_getrf.py:125:26-170:2: Cannot set item in `dict[str, dict[str, bytes | date | int | list[str] | str | tuple[()] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit]]]]]]` [unsupported-operation]
- ERROR jax/_src/internal_test_util/export_back_compat_test_data/rocm_qr_hipsolver_geqrf.py:156:26-213:2: Cannot set item in `dict[str, dict[str, bytes | date | int | list[str] | str | tuple[()] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]]]` [unsupported-operation]
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/cuda_tridiagonal_cusolver_sytrd.py:205:22-227:51: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` [bad-assignment]
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/gpu_eigh_solver_syev.py:277:20-306:4: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[()] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` [bad-assignment]
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/rocm_cholesky_solver_potrf.py:165:12-173:25: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` [bad-assignment]
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/rocm_cholesky_solver_potrf.py:174:22-181:75: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` [bad-assignment]
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/rocm_lu_rocsolver_getrf.py:131:22-133:130: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[()] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit]]], ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit]]]]` [bad-assignment]
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/rocm_qr_hipsolver_geqrf.py:162:22-176:24: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]], ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[()] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` [bad-assignment]
- ERROR jax/_src/internal_test_util/export_back_compat_test_data/rocm_svd_hipsolver_gesvd.py:192:36-289:2: Cannot set item in `dict[str, dict[str, bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]]]` [unsupported-operation]
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/rocm_svd_hipsolver_gesvd.py:197:12-214:25: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` [bad-assignment]
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/rocm_svd_hipsolver_gesvd.py:215:22-250:24: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` [bad-assignment]
- ERROR jax/_src/internal_test_util/export_back_compat_test_data/rocm_tridiagonal_hipsolver_sytrd.py:178:26-262:2: Cannot set item in `dict[str, dict[str, bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]]]` [unsupported-operation]
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/rocm_tridiagonal_hipsolver_sytrd.py:183:12-200:25: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` [bad-assignment]
+ ERROR jax/_src/internal_test_util/export_back_compat_test_data/rocm_tridiagonal_hipsolver_sytrd.py:201:22-224:51: `tuple[ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[complexfloating[_32Bit, _32Bit]]]]` is not assignable to `bytes | date | int | list[str] | str | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]] | tuple[ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]], ndarray[tuple[Any, ...], dtype[floating[_32Bit]]]]` [bad-assignment]
+ ERROR jax/experimental/colocated_python/serialization.py:245:10-36: `type[NamedSharding]` is not assignable to `type[Mesh]` [bad-assignment]
+ ERROR jax/experimental/colocated_python/serialization.py:246:10-20: `type[DeviceList]` is not assignable to `type[Mesh]` [bad-assignment]
+ ERROR jax/experimental/colocated_python/serialization.py:247:10-43: `type[SingleDeviceSharding]` is not assignable to `type[Mesh]` [bad-assignment]
spark (https://github.com/apache/spark)
- ERROR python/pyspark/pandas/tests/groupby/test_describe.py:33:22-76: Argument `dict[str, list[int] | list[str]]` is not assignable to parameter `object` with type `dict[str, list[int]]` in function `list.append` [bad-argument-type]
+ ERROR python/pyspark/pandas/tests/groupby/test_describe.py:33:28-43: `list[str]` is not assignable to `list[int]` [bad-assignment]
- ERROR python/pyspark/pandas/tests/groupby/test_describe.py:69:22-82: Argument `dict[str, list[int] | list[str]]` is not assignable to parameter `object` with type `dict[str, list[str]]` in function `list.append` [bad-argument-type]
+ ERROR python/pyspark/pandas/tests/groupby/test_describe.py:69:50-59: `list[int]` is not assignable to `list[str]` [bad-assignment]
cwltool (https://github.com/common-workflow-language/cwltool)
- ERROR cwltool/command_line_tool.py:850:78-98: `dict[str, list[MutableMapping[str, CWLOutputType | None] | MutableSequence[CWLOutputType | None] | bool | float | int | str | CWLDirectoryType | CWLFileType] | list[Any]]` is not assignable to `dict[str, MutableMapping[str, MutableMapping[str, CWLOutputType | None] | MutableSequence[CWLOutputType | None] | bool | float | int | str | CWLDirectoryType | CWLFileType | None] | MutableSequence[int | str]]` [bad-assignment]
+ ERROR cwltool/command_line_tool.py:850:90-97: `list[MutableMapping[str, CWLOutputType | None] | MutableSequence[CWLOutputType | None] | bool | float | int | str | CWLDirectoryType | CWLFileType] | list[Any]` is not assignable to `MutableMapping[str, MutableMapping[str, CWLOutputType | None] | MutableSequence[CWLOutputType | None] | bool | float | int | str | CWLDirectoryType | CWLFileType | None] | MutableSequence[int | str]` [bad-assignment]
- ERROR tests/test_examples.py:80:15-88:6: `dict[str, dict[str, dict[str, @_ | None] | dict[str, bool] | dict[str, int] | dict[str, str]] | list[str]]` is not assignable to TypedDict key `inputs` with type `MutableMapping[str, MutableMapping[str, CWLOutputType | None] | MutableSequence[CWLOutputType | None] | bool | float | int | str | CWLDirectoryType | CWLFileType | None]` [bad-assignment]
+ ERROR tests/test_examples.py:81:16-86:10: `dict[str, dict[str, @_ | None] | dict[str, bool] | dict[str, int] | dict[str, str]]` is not assignable to `MutableMapping[str, CWLOutputType | None] | MutableSequence[CWLOutputType | None] | bool | float | int | str | CWLDirectoryType | CWLFileType | None` [bad-assignment]
+ ERROR tests/test_examples.py:87:16-26: `list[str]` is not assignable to `MutableMapping[str, CWLOutputType | None] | MutableSequence[CWLOutputType | None] | bool | float | int | str | CWLDirectoryType | CWLFileType | None` [bad-assignment]
- ERROR tests/test_examples.py:368:26-424:6: `dict[str, list[dict[str, list[dict[str, str | dict[str, str]]] | str | dict[str, list[dict[str, str | dict[str, str]] | dict[str, str | dict[str, list[dict[str, str]] | str]] | dict[str, str | dict[str, list[dict[str, list[dict[str, str]] | str]] | str]]] | str]]] | str]` is not assignable to `MutableMapping[str, MutableMapping[str, CWLOutputType | None] | MutableSequence[CWLOutputType | None] | bool | float | int | str | CWLDirectoryType | CWLFileType | None]` [bad-assignment]
+ ERROR tests/test_examples.py:370:18-423:10: `list[dict[str, list[dict[str, str | dict[str, str]]] | str | dict[str, list[dict[str, str | dict[str, str]] | dict[str, str | dict[str, list[dict[str, str]] | str]] | dict[str, str | dict[str, list[dict[str, list[dict[str, str]] | str]] | str]]] | str]]]` is not assignable to `MutableMapping[str, CWLOutputType | None] | MutableSequence[CWLOutputType | None] | bool | float | int | str | CWLDirectoryType | CWLFileType | None` [bad-assignment]
- ERROR tests/test_streaming.py:94:31-100:6: `dict[str, dict[str, bool | str]]` is not assignable to `MutableMapping[str, MutableMapping[str, CWLOutputType | None] | MutableSequence[CWLOutputType | None] | bool | float | int | str | CWLDirectoryType | CWLFileType | None]` [bad-assignment]
+ ERROR tests/test_streaming.py:95:16-99:10: `dict[str, bool | str]` is not assignable to `MutableMapping[str, CWLOutputType | None] | MutableSequence[CWLOutputType | None] | bool | float | int | str | CWLDirectoryType | CWLFileType | None` [bad-assignment]
cryptography (https://github.com/pyca/cryptography)
- ERROR tests/utils.py:419:17-425:18: Argument `dict[str, bytes | int | str]` is not assignable to parameter `object` with type `dict[str, int | str]` in function `list.append` [bad-argument-type]
+ ERROR tests/utils.py:424:28-54: `bytes` is not assignable to `int | str` [bad-assignment]
prefect (https://github.com/PrefectHQ/prefect)
+ ERROR src/integrations/prefect-docker/prefect_docker/images.py:65:23-33: `str` is not assignable to `dict[str, Any]` [bad-assignment]
- ERROR src/integrations/prefect-docker/prefect_docker/images.py:64:19-70:6: `dict[str, bool | dict[str, Any] | str | None]` is not assignable to variable `pull_kwargs` with type `dict[str, dict[str, Any]]` [bad-assignment]
+ ERROR src/integrations/prefect-docker/prefect_docker/images.py:66:16-19: `str | None` is not assignable to `dict[str, Any]` [bad-assignment]
+ ERROR src/integrations/prefect-docker/prefect_docker/images.py:67:21-29: `str | None` is not assignable to `dict[str, Any]` [bad-assignment]
+ ERROR src/integrations/prefect-docker/prefect_docker/images.py:68:21-29: `bool` is not assignable to `dict[str, Any]` [bad-assignment]
- ERROR src/prefect/server/events/jinja_filters.py:83:74-87:2: `dict[str, (text: str | None) -> str | None]` is not assignable to `dict[str, (Mapping[str, Any], Any) -> str | None]` [bad-assignment]
aiortc (https://github.com/aiortc/aiortc)
- ERROR src/aiortc/contrib/signaling.py:44:19-49:10: `dict[str, int | str | None]` is not assignable to variable `message` with type `dict[str, int | str]` [bad-assignment]
+ ERROR src/aiortc/contrib/signaling.py:46:19-29: `str | None` is not assignable to `int | str` [bad-assignment]
+ ERROR src/aiortc/contrib/signaling.py:47:22-39: `int | None` is not assignable to `int | str` [bad-assignment]
materialize (https://github.com/MaterializeInc/materialize)
+ ERROR test/balancerd/mzcompose.py:115:49-72: `str` is not assignable to `list[str]` [bad-assignment]
+ ERROR test/balancerd/mzcompose.py:137:49-70: `str` is not assignable to `list[str]` [bad-assignment]
+ ERROR test/balancerd/mzcompose.py:166:49-72: `str` is not assignable to `list[str]` [bad-assignment]
+ ERROR test/balancerd/mzcompose.py:177:49-76: `str` is not assignable to `list[str]` [bad-assignment]
+ ERROR test/balancerd/mzcompose.py:200:49-75: `str` is not assignable to `list[str]` [bad-assignment]
+ ERROR test/balancerd/mzcompose.py:294:53-79: `str` is not assignable to `list[str]` [bad-assignment]
+ ERROR test/balancerd/mzcompose.py:317:53-76: `str` is not assignable to `list[str]` [bad-assignment]
+ ERROR test/balancerd/mzcompose.py:691:53-76: `str` is not assignable to `list[str]` [bad-assignment]
+ ERROR test/balancerd/mzcompose.py:891:53-80: `str` is not assignable to `list[str]` [bad-assignment]
+ ERROR test/balancerd/mzcompose.py:909:53-79: `str` is not assignable to `list[str]` [bad-assignment]
apprise (https://github.com/caronc/apprise)
- ERROR apprise/plugins/fluxer.py:788:34-796:10: `dict[str, NotifyFormat | OverflowMode | bool | float | str | None]` is not assignable to `dict[str, str]` [bad-assignment]
+ ERROR apprise/plugins/fluxer.py:789:21-30: `NotifyFormat | OverflowMode | bool | float | str | None` is not assignable to `str` [bad-assignment]
- ERROR tests/test_attach_http.py:147:45-150:10: `dict[str, int | str]` is not assignable to `dict[str, str]` [bad-assignment]
+ ERROR tests/test_attach_http.py:148:31-44: `int` is not assignable to `str` [bad-assignment]
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
- ERROR pymongo/asynchronous/auth.py:365:69-374:2: `dict[str, ((credentials: MongoCredential, conn: AsyncConnection) -> Coroutine[Unknown, Unknown, None]) | ((credentials: MongoCredential, conn: AsyncConnection, reauthenticate: bool) -> Coroutine[Unknown, Unknown, Mapping[str, Any] | None]) | partial[Coroutine[Unknown, Unknown, None]]]` is not assignable to `Mapping[str, (...) -> Coroutine[Any, Any, None]]` [bad-assignment]
- ERROR pymongo/synchronous/auth.py:360:48-369:2: `dict[str, ((credentials: MongoCredential, conn: Connection) -> None) | ((credentials: MongoCredential, conn: Connection, reauthenticate: bool) -> Mapping[str, Any] | None) | partial[None]]` is not assignable to `Mapping[str, (...) -> None]` [bad-assignment]
pandera (https://github.com/pandera-dev/pandera)
- ERROR tests/pandas/test_decorators.py:1141:9-1144:10: Argument `dict[str, pandas.core.frame.DataFrame]` is not assignable to parameter `dict_of_df` with type `dict[str, pandera.typing.pandas.DataFrame[OnlyZeroesSchema]]` in function `validate_dict` [bad-argument-type]
- ERROR tests/pandas/test_decorators.py:1149:13-1152:14: Argument `dict[str, pandas.core.frame.DataFrame]` is not assignable to parameter `dict_of_df` with type `dict[str, pandera.typing.pandas.DataFrame[OnlyZeroesSchema]]` in function `validate_dict` [bad-argument-type]
- ERROR tests/pandas/test_decorators.py:1157:13-1160:14: Argument `dict[str, pandas.core.frame.DataFrame]` is not assignable to parameter `dict_of_df` with type `dict[str, pandera.typing.pandas.DataFrame[OnlyZeroesSchema]]` in function `validate_dict` [bad-argument-type]
- ERROR tests/pandas/test_decorators.py:1175:13-1178:14: Argument `dict[str, pandas.core.frame.DataFrame]` is not assignable to parameter `dict_of_df` with type `dict[str, pandera.typing.pandas.DataFrame[OnlyZeroesSchema]]` in function `validate_dict_wrong_outputs` [bad-argument-type]
- ERROR tests/pandas/test_decorators.py:1202:9-1205:10: Argument `dict[str, pandas.core.frame.DataFrame]` is not assignable to parameter `dict_of_union_df` with type `dict[str, pandera.typing.pandas.DataFrame[OnlyOnesSchema] | pandera.typing.pandas.DataFrame[OnlyZeroesSchema]]` in function `validate_dict` [bad-argument-type]
- ERROR tests/pandas/test_decorators.py:1210:13-1213:14: Argument `dict[str, pandas.core.frame.DataFrame]` is not assignable to parameter `dict_of_union_df` with type `dict[str, pandera.typing.pandas.DataFrame[OnlyOnesSchema] | pandera.typing.pandas.DataFrame[OnlyZeroesSchema]]` in function `validate_dict` [bad-argument-type]
- ERROR tests/pandas/test_decorators.py:1218:13-1221:14: Argument `dict[str, pandas.core.frame.DataFrame]` is not assignable to parameter `dict_of_union_df` with type `dict[str, pandera.typing.pandas.DataFrame[OnlyOnesSchema] | pandera.typing.pandas.DataFrame[OnlyZeroesSchema]]` in function `validate_dict` [bad-argument-type]
- ERROR tests/pandas/test_decorators.py:1244:13-1247:14: Argument `dict[str, pandas.core.frame.DataFrame]` is not assignable to parameter `dict_of_union_df` with type `dict[str, pandera.typing.pandas.DataFrame[OnlyOnesSchema] | pandera.typing.pandas.DataFrame[OnlyZeroesSchema]]` in function `validate_dict_wrong_outputs` [bad-argument-type]
+ ERROR tests/pandas/test_decorators.py:1142:25-52: `pandas.core.frame.DataFrame` is not assignable to `pandera.typing.pandas.DataFrame[OnlyZeroesSchema]` [bad-assignment]
+ ERROR tests/pandas/test_decorators.py:1143:25-52: `pandas.core.frame.DataFrame` is not assignable to `pandera.typing.pandas.DataFrame[OnlyZeroesSchema]` [bad-assignment]
+ ERROR tests/pandas/test_decorators.py:1150:29-56: `pandas.core.frame.DataFrame` is not assignable to `pandera.typing.pandas.DataFrame[OnlyZeroesSchema]` [bad-assignment]
+ ERROR tests/pandas/test_decorators.py:1151:29-56: `pandas.core.frame.DataFrame` is not assignable to `pandera.typing.pandas.DataFrame[OnlyZeroesSchema]` [bad-assignment]
+ ERROR tests/pandas/test_decorators.py:1158:29-56: `pandas.core.frame.DataFrame` is not assignable to `pandera.typing.pandas.DataFrame[OnlyZeroesSchema]` [bad-assignment]
+ ERROR tests/pandas/test_decorators.py:1159:29-56: `pandas.core.frame.DataFrame` is not assignable to `pandera.typing.pandas.DataFrame[OnlyZeroesSchema]` [bad-assignment]
+ ERROR tests/pandas/test_decorators.py:1176:27-54: `pandas.core.frame.DataFrame` is not assignable to `pandera.typing.pandas.DataFrame[OnlyZeroesSchema]` [bad-assignment]
+ ERROR tests/pandas/test_decorators.py:1177:25-52: `pandas.core.frame.DataFrame` is not assignable to `pandera.typing.pandas.DataFrame[OnlyZeroesSchema]` [bad-assignment]
+ ERROR tests/pandas/test_decorators.py:1203:23-50: `pandas.core.frame.DataFrame` is not assignable to `pandera.typing.pandas.DataFrame[OnlyOnesSchema] | pandera.typing.pandas.DataFrame[OnlyZeroesSchema]` [bad-assignment]
+ ERROR tests/pandas/test_decorators.py:1204:21-48: `pandas.core.frame.DataFrame` is not assignable to `pandera.typing.pandas.DataFrame[OnlyOnesSchema] | pandera.typing.pandas.DataFrame[OnlyZeroesSchema]` [bad-assignment]
+ ERROR tests/pandas/test_decorators.py:1211:27-54: `pandas.core.frame.DataFrame` is not assignable to `pandera.typing.pandas.DataFrame[OnlyOnesSchema] | pandera.typing.pandas.DataFrame[OnlyZeroesSchema]` [bad-assignment]
+ ERROR tests/pandas/test_decorators.py:1212:25-52: `pandas.core.frame.DataFrame` is not assignable to `pandera.typing.pandas.DataFrame[OnlyOnesSchema] | pandera.typing.pandas.DataFrame[OnlyZeroesSchema]` [bad-assignment]
+ ERROR tests/pandas/test_decorators.py:1219:27-54: `pandas.core.frame.DataFrame` is not assignable to `pandera.typing.pandas.DataFrame[OnlyOnesSchema] | pandera.typing.pandas.DataFrame[OnlyZeroesSchema]` [bad-assignment]
+ ERROR tests/pandas/test_decorators.py:1220:25-52: `pandas.core.frame.DataFrame` is not assignable to `pandera.typing.pandas.DataFrame[OnlyOnesSchema] | pandera.typing.pandas.DataFrame[OnlyZeroesSchema]` [bad-assignment]
+ ERROR tests/pandas/test_decorators.py:1245:27-54: `pandas.core.frame.DataFrame` is not assignable to `pandera.typing.pandas.DataFrame[OnlyOnesSchema] | pandera.typing.pandas.DataFrame[OnlyZeroesSchema]` [bad-assignment]
+ ERROR tests/pandas/test_decorators.py:1246:25-52: `pandas.core.frame.DataFrame` is not assignable to `pandera.typing.pandas.DataFrame[OnlyOnesSchema] | pandera.typing.pandas.DataFrame[OnlyZeroesSchema]` [bad-assignment]
dragonchain (https://github.com/dragonchain/dragonchain)
- ERROR dragonchain/webserver/lib/transactions.py:131:12-48: Returned type `dict[str, Unknown | None]` is not assignable to declared return type `dict[str, str]` [bad-return]
+ ERROR dragonchain/webserver/lib/transactions.py:131:31-47: `Unknown | None` is not assignable to `str` [bad-assignment]
static-frame (https://github.com/static-frame/static-frame)
+ ERROR static_frame/test/unit/test_frame.py:6736:35-63: No matching overload found for function `collections.defaultdict.__init__` called with arguments: (() -> None, dict[str, bool]) [no-matching-overload]
dd-trace-py (https://github.com/DataDog/dd-trace-py)
- ERROR ddtrace/contrib/internal/botocore/services/bedrock.py:293:12-58: Returned type `dict[str, list[str | Unknown | None] | list[Any] | list[Unknown]]` is not assignable to declared return type `dict[str, list[str]]` [bad-return]
+ ERROR ddtrace/contrib/internal/botocore/services/bedrock.py:293:21-25: `list[str | Unknown | None] | list[Any] | list[Unknown]` is not assignable to `list[str]` [bad-assignment]
+ ERROR ddtrace/contrib/internal/botocore/services/bedrock.py:293:44-57: `list[str | Unknown | None] | list[Unknown]` is not assignable to `list[str]` [bad-assignment]
pandas (https://github.com/pandas-dev/pandas)
+ ERROR pandas/io/stata.py:2530:38-46: `type[signedinteger[_32Bit]]` is not assignable to `type[int16] | type[int32] | type[int8]` [bad-assignment]
+ ERROR pandas/io/stata.py:2530:53-61: `type[signedinteger[_16Bit]]` is not assignable to `type[int16] | type[int32] | type[int8]` [bad-assignment]
+ ERROR pandas/io/stata.py:2530:68-75: `type[signedinteger[_8Bit]]` is not assignable to `type[int16] | type[int32] | type[int8]` [bad-assignment]
meson (https://github.com/mesonbuild/meson)
- ERROR mesonbuild/envconfig.py:98:68-120:2: `dict[str, list[str]]` is not assignable to `Mapping[str, ImmutableListProtocol[str]]` [bad-assignment]
- ERROR mesonbuild/envconfig.py:123:64-145:2: `dict[str, list[str]]` is not assignable to `Mapping[str, ImmutableListProtocol[str]]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:100:10-16: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
- ERROR mesonbuild/envconfig.py:151:71-156:2: `dict[str, list[str]]` is not assignable to `Mapping[str, ImmutableListProtocol[str]]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:101:12-19: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:102:11-18: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:103:15-25: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:104:10-16: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:105:16-22: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:106:13-21: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:107:15-25: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:108:13-22: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:109:13-22: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:110:13-21: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:113:13-22: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:114:15-25: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:115:13-22: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:116:19-28: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:117:16-27: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:118:18-31: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:119:16-28: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:125:11-17: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:126:11-17: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:127:11-17: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:128:11-17: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:129:16-27: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:130:16-27: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:131:15-25: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:132:16-27: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:133:13-21: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:134:16-27: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:135:14-23: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:136:16-33: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:139:14-23: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:140:14-23: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:141:19-33: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:142:13-21: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:143:16-27: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:144:20-35: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:152:13-21: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:153:19-27: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:154:16-27: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
+ ERROR mesonbuild/envconfig.py:155:18-31: `list[str]` is not assignable to `ImmutableListProtocol[str]` [bad-assignment]
- ERROR mesonbuild/interpreter/primitives/boolean.py:22:25-27:6: `dict[MesonOperator, tuple[type[bool], (obj: Unknown, x: Unknown) -> Unknown] | tuple[None, (obj: Unknown, x: Unknown) -> bool] | tuple[None, (obj: Unknown, x: Unknown) -> Unknown]]` is not assignable to attribute `TRIVIAL_OPERATORS` with type `dict[MesonOperator, tuple[tuple[type[Any], ...] | type[Any], (Unknown, Unknown) -> HoldableObject | MesonInterpreterObject | Sequence[TYPE_elementary] | Sequence[TYPE_var] | bool | dict[str, TYPE_elementary] | dict[str, TYPE_var] | int | str]]` [bad-assignment]
+ ERROR mesonbuild/interpreter/primitives/boolean.py:23:29-67: `tuple[None, (obj: Unknown, x: Unknown) -> Unknown]` is not assignable to `tuple[tuple[type[Any], ...] | type[Any], (Unknown, Unknown) -> HoldableObject | MesonInterpreterObject | Sequence[TYPE_elementary] | Sequence[TYPE_var] | bool | dict[str, TYPE_elementary] | dict[str, TYPE_var] | int | str]` [bad-assignment]
+ ERROR mesonbuild/interpreter/primitives/boolean.py:24:28-70: `tuple[None, (obj: Unknown, x: Unknown) -> bool]` is not assignable to `tuple[tuple[type[Any], ...] | type[Any], (Unknown, Unknown) -> HoldableObject | MesonInterpreterObject | Sequence[TYPE_elementary] | Sequence[TYPE_var] | bool | dict[str, TYPE_elementary] | dict[str, TYPE_var] | int | str]` [bad-assignment]
- ERROR mesonbuild/interpreter/primitives/integer.py:25:25-39:6: `dict[MesonOperator, tuple[type[int], (obj: Unknown, x: Unknown) -> Unknown] | tuple[None, (obj: Unknown, x: Unknown) -> Unknown]]` is not assignable to attribute `TRIVIAL_OPERATORS` with type `dict[MesonOperator, tuple[tuple[type[Any], ...] | type[Any], (Unknown, Unknown) -> HoldableObject | MesonInterpreterObject | Sequence[TYPE_elementary] | Sequence[TYPE_var] | bool | dict[str, TYPE_elementary] | dict[str, TYPE_var] | int | str]]` [bad-assignment]
+ ERROR mesonbuild/interpreter/primitives/integer.py:27:31-70: `tuple[None, (obj: Unknown, x: Unknown) -> Unknown]` is not assignable to `tuple[tuple[type[Any], ...] | type[Any], (Unknown, Unknown) -> HoldableObject | MesonInterpreterObject | Sequence[TYPE_elementary] | Sequence[TYPE_var] | bool | dict[str, TYPE_elementary] | dict[str, TYPE_var] | int | str]` [bad-assignment]
- ERROR mesonbuild/mintro.py:411:80-417:6: `dict[str, list[str] | str | None]` is not assignable to `dict[str, list[dict[str, str]] | list[str] | str]` [bad-assignment]
+ ERROR mesonbuild/mintro.py:412:20-45: `str | None` is not assignable to `list[dict[str, str]] | list[str] | str` [bad-assignment]
- ERROR run_project_tests.py:1360:52-75: Argument `dict[str, object | str]` is not assignable to parameter `attrib` with type `dict[str, str]` in function `xml.etree.ElementTree.SubElement` [bad-argument-type]
+ ERROR run_project_tests.py:1360:64-74: `object | str` is not assignable to `str` [bad-assignment]
- ERROR unittests/optiontests.py:328:45-74: Argument `dict[OptionKey, bool]` is not assignable to parameter `D_args` with type `dict[OptionKey, str | None]` in function `mesonbuild.options.OptionStore.set_from_configure_command` [bad-argument-type]
+ ERROR unittests/optiontests.py:328:69-73: `bool` is not assignable to `str | None` [bad-assignment]
core (https://github.com/home-assistant/core)
- ERROR homeassistant/components/bthome/logbook.py:32:16-35:10: Returned type `dict[str, DeviceEntry | str]` is not assignable to declared return type `dict[str, str]` [bad-return]
+ ERROR homeassistant/components/bthome/logbook.py:33:33-37: `DeviceEntry | str` is not assignable to `str` [bad-assignment]
- ERROR homeassistant/components/websocket_api/commands.py:1280:27-62: Cannot set item in `dict[str, dict[str, bool | None]]` [unsupported-operation]
+ ERROR homeassistant/components/websocket_api/commands.py:1280:53-61: `str` is not assignable to `bool | None` [bad-assignment]
xarray (https://github.com/pydata/xarray)
- ERROR xarray/coding/cftime_offsets.py:687:54-718:2: `dict[str, type[Day] | type[Hour] | type[Microsecond] | type[Millisecond] | type[Minute] | type[MonthBegin] | type[MonthEnd] | type[Second] | type[YearBegin] | type[YearEnd] | partial[QuarterBegin] | partial[QuarterEnd] | type[BaseCFTimeOffset]]` is not assignable to `Mapping[str, type[BaseCFTimeOffset]]` [bad-assignment]
kornia (https://github.com/kornia/kornia)
- ERROR kornia/models/efficient_vit/nn/act.py:31:51-37:2: `dict[str, partial[Unknown]]` is not assignable to `dict[str, type[Any]]` [bad-assignment]
pydantic (https://github.com/pydantic/pydantic)
+ ERROR pydantic/main.py:112:28-119: `(model: BaseModel, name: str, val: Any) -> dict[str, Any] | tuple[dict[str, Any], dict[str, Any] | None, set[str]] | Unknown` is not assignable to `(BaseModel, str, Any) -> None` [bad-assignment]
koda-validate (https://github.com/keithasaurus/koda-validate)
- ERROR koda_validate/serialization/json_schema.py:210:12-215:6: Returned type `dict[str, bool | dict[str, Serializable] | list[str] | str]` is not assignable to declared return type `dict[str, Serializable]` [bad-return]
- ERROR koda_validate/serialization/json_schema.py:230:12-235:6: Returned type `dict[str, bool | dict[str, Serializable] | list[str] | str]` is not assignable to declared return type `dict[str, Serializable]` [bad-return]
- ERROR koda_validate/serialization/json_schema.py:278:12-283:6: Returned type `dict[str, bool | dict[str, Serializable] | list[str] | str]` is not assignable to declared return type `dict[str, Serializable]` [bad-return]
graphql-core (https://github.com/graphql-python/graphql-core)
- ERROR src/graphql/utilities/build_client_schema.py:264:81-271:6: `dict[str, ((enum_introspection: IntrospectionEnumType) -> GraphQLEnumType) | ((input_object_introspection: IntrospectionInputObjectType) -> GraphQLInputObjectType) | ((interface_introspection: IntrospectionInterfaceType) -> GraphQLInterfaceType) | ((object_introspection: IntrospectionObjectType) -> GraphQLObjectType) | ((scalar_introspection: IntrospectionScalarType) -> GraphQLScalarType) | ((union_introspection: IntrospectionUnionType) -> GraphQLUnionType)]` is not assignable to `dict[str, (IntrospectionType) -> GraphQLNamedType]` [bad-assignment]
|
Primer Diff Classification❌ 1 regression(s) | ✅ 16 improvement(s) | ➖ 5 neutral | 22 project(s) total | +124, -57 errors 1 regression(s) across static-frame. error kinds:
Detailed analysis❌ Regression (1)static-frame (+1)
✅ Improvement (16)rotki (+1, -3)
prefect (+4, -2)
aiortc (+2, -1)
materialize (+10)
apprise (+2, -2)
fluxer.py:789 — The new error says test_attach_http.py:148 — Overall: 2 removed errors (old-style whole-dict errors) replaced by 2 new errors (precise per-entry errors). One is a genuine improvement (test_attach_http.py — real bug, better location). The other (fluxer.py) is a false positive in both old and new forms, but the new form at least points to the specific entry. Net effect is improved error quality.
mongo-python-driver (-2)
pandera (+16, -8)
dragonchain (+1, -1)
dd-trace-py (+2, -1)
pandas (+3)
meson (+46, -8)
xarray (-1)
kornia (-1)
pydantic (+1)
koda-validate (-3)
graphql-core (-1)
➖ Neutral (5)jax (+25, -14)
spark (+2, -2)
cwltool (+5, -4)
cryptography (+1, -1)
The new error ( The net effect is neutral-to-slightly-improved: the old error was a false positive on the whole dict literal passed to Since both the old and new errors are false positives of roughly equal severity (one removed, one added), this is essentially neutral — the error quality improved (more precise location) but the false positive wasn't eliminated.
core (+2, -2)
For logbook.py: The old error was For commands.py: The old error was The net effect is zero change in error count (2 removed, 2 added), with narrower error spans. The underlying issues being flagged are the same, and both are pyrefly-only. The error messages are more precise (pointing to the exact problematic value), which is the stated goal of the PR.
Suggested fixesSummary: The new dict literal per-item checking logic interferes with overload resolution by prematurely returning the hint type when a mismatch is detected during tentative overload matching, causing defaultdict.init to fail. 1. In the dict literal inference code in AnswersSolver in
Was this helpful? React with 👍 or 👎 Classification by primer-classifier (22 LLM) |
Summary
Fixes #893
Narrowed dict-literal assignment errors to the first mismatching key/value/unpack when a dict[...] hint is present, so the caret lands on the wrong entry instead of the whole { ... }.
to decide: only show first error for now. Maybe show full error? But will it too noisy?
Test Plan
Added a unit test that asserts the error range points at the offending value literal.