Skip to content

[ty] do not union Unknown into unannotated container types#23718

Merged
carljm merged 6 commits intomainfrom
cjm/remove-container-literal-unknown
Mar 5, 2026
Merged

[ty] do not union Unknown into unannotated container types#23718
carljm merged 6 commits intomainfrom
cjm/remove-container-literal-unknown

Conversation

@carljm
Copy link
Contributor

@carljm carljm commented Mar 4, 2026

Summary

Part of astral-sh/ty#1240

Stop unioning Unknown into the types of un-annotated container literals.

We discussed perhaps continuing to union Unknown if the inferred type is a singleton type like None. I'd like to explore this as a separate change so we can see the ecosystem impact more clearly.

Test Plan

Adjusted many mdtest expectations.

There's one test case that regresses with this change, because we don't fully support union type contexts (it can require a lot of repeat inference in pathological cases). So x10: list[int | str] | list[int | None] = [1, 2, 3] previously passed only because we inferred the RHS as list[Unknown | int] -- now we infer it as list[int] and the assignment fails due to invariance. I've kept this test as a TODO since it's not trivial to fix. Mypy errors in the same way we now do, suggesting it's not necessarily a huge priority either.

Ecosystem

This change is expected to cause new diagnostics and some false positives, since we are replacing very-forgiving gradual types with non-gradual inference heuristics.

Many of these issues could be solved or significantly mitigated by astral-sh/ty#1473, depending how far we are able to go with that, and particularly whether we can afford to apply it also to container literals which are not empty at construction. The downside of broad application of this approach is that in some cases it could cause us to widen container types when the user actually just made a mistake and added the wrong thing to a container, and would prefer an error at that location.

Some categories of new error that show up in the ecosystem report:

Implicit TypedDicts

These are cases where the dictionary is heterogeneous and would ideally be typed as a TypedDict but isn't, for example:

def make_person(photo: bytes | None):
    person = {"name": "Pat", age: 29}
    if photo is not None:
        person["photo"] = photo

We (and pyrefly, and pyright in strict mode) error on the last line here because we already inferred dict[str, str | int], so we can't add a bytes value.

Mypy prefers common-base joins over union joins, so it infers dict[str, object], which avoids the error adding a bytes value. This means the value type is less precise, which theoretically means potentially more errors using values from the dict later. But in practice with this heterogeneous pattern, either object or the union will cause similar problems when using values from the dict -- in either case you'd probably have to cast or narrow.

Pyright (in non-strict mode) has a special case where it falls back to Unknown when it sees heterogenous value types, so it infers this as dict[str, Unknown].

I think we could consider either the mypy or pyright approaches here, but we don't need to do it in this PR; we can file an issue and consider it as a follow-up.

Another symptom of this same root cause is repetitive diagnostics arising from a large union inferred as value type; the same fixes would address this.

Negative intersections, particularly with e.g. ~AlwaysFalsy or ~None.

Example:

class A: ...

def _(a: A | None) -> dict[str, A]:
    if a:
        d = {"a": a}
        return d
    return {}

We error on return d because "expected dict[str, A], found dict[str, A & ~AlwaysFalsy]". This is an issue specific to intersection types, so no other type checker has this problem.

I think when we "promote literals" (we may need to give this operation a broader name -- it's really "type promotion to give a better inferred type when invariance means too-precise is bad") we should also eliminate all negative types from intersections. I would prefer to do this as a separate PR for easier review and better visibility of ecosystem impact, but I think it's high priority to land soon after this PR (ideally before a release).

Overly-precise inference for singleton None

This did show up, to the tune of ~100 new diagnostics (example), so I think it is worth addressing as a follow-up.

@carljm carljm added the ty Multi-file analysis & type inference label Mar 4, 2026
@astral-sh-bot
Copy link

astral-sh-bot bot commented Mar 4, 2026

Typing conformance results improved 🎉

The percentage of diagnostics emitted that were expected errors increased from 86.95% to 87.07%. The percentage of expected errors that received a diagnostic increased from 77.43% to 77.62%.

Summary

How 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 (E) are true positives when ty flags the expected location and false negatives when it does not. Optional annotations (E?) are true positives when flagged but true negatives (not false negatives) when not. Tagged annotations (E[tag]) require ty to flag exactly one of the tagged lines; tagged multi-annotations (E[tag+]) allow any number up to the tag count. Flagging unexpected locations counts as a false positive.

Metric Old New Diff Outcome
True Positives 806 808 +2 ⏫ (✅)
False Positives 121 120 -1 ⏬ (✅)
False Negatives 235 233 -2 ⏬ (✅)
Total Diagnostics 1000 1003 +3
Precision 86.95% 87.07% +0.12% ⏫ (✅)
Recall 77.43% 77.62% +0.19% ⏫ (✅)

Test file breakdown

1 file altered
File True Positives False Positives False Negatives Status
constructors_callable.py 9 (+2) ✅ 6 (-1) ✅ 3 (-2) ✅ 📈 Improving
Total (all files) 808 (+2) ✅ 120 (-1) ✅ 233 (-2) ✅ 63/131

True positives added (2)

2 diagnostics
Test case Diff

constructors_callable.py:186

+error[invalid-argument-type] Argument is incorrect: Expected `list[int \| str]`, found `list[int]`
+error[invalid-argument-type] Argument is incorrect: Expected `list[int \| str]`, found `list[str]`

constructors_callable.py:197

+error[invalid-argument-type] Argument is incorrect: Expected `list[int \| str]`, found `list[int]`
+error[invalid-argument-type] Argument is incorrect: Expected `list[int \| str]`, found `list[str]`

False positives removed (1)

1 diagnostic
Test case Diff

constructors_callable.py:185

-error[type-assertion-failure] Type `Class8[Unknown \| str]` does not match asserted type `Class8[str]`

True positives changed (8)

8 diagnostics
Test case Diff

aliases_implicit.py:107

-error[invalid-type-form] Variable of type `list[Unknown \| <class 'int'> \| <class 'str'>]` is not allowed in a type expression
+error[invalid-type-form] Variable of type `list[<class 'int'> \| <class 'str'>]` is not allowed in a type expression

aliases_implicit.py:109

-error[invalid-type-form] Variable of type `list[Unknown \| <class 'int'>]` is not allowed in a type expression
+error[invalid-type-form] Variable of type `list[<class 'int'>]` is not allowed in a type expression

aliases_implicit.py:110

-error[invalid-type-form] Variable of type `dict[Unknown \| str, Unknown \| str]` is not allowed in a type expression
+error[invalid-type-form] Variable of type `dict[str, str]` is not allowed in a type expression

aliases_type_statement.py:43

-error[invalid-type-form] Invalid subscript of object of type `list[Unknown \| <class 'int'>]` in type expression
-error[invalid-type-form] Int literals are not allowed in this context in a type expression
+error[invalid-type-form] Invalid subscript of object of type `list[<class 'int'>]` in type expression
+error[invalid-type-form] Int literals are not allowed in this context in a type expression

aliases_typealiastype.py:58

-error[invalid-type-form] Invalid subscript of object of type `list[Unknown \| <class 'int'>]` in type expression
-error[invalid-type-form] Int literals are not allowed in this context in a type expression
+error[invalid-type-form] Invalid subscript of object of type `list[<class 'int'>]` in type expression
+error[invalid-type-form] Int literals are not allowed in this context in a type expression

annotations_forward_refs.py:47

-error[invalid-type-form] Invalid subscript of object of type `list[Unknown \| <class 'int'>]` in type expression
-error[invalid-type-form] Int literals are not allowed in this context in a type expression
+error[invalid-type-form] Invalid subscript of object of type `list[<class 'int'>]` in type expression
+error[invalid-type-form] Int literals are not allowed in this context in a type expression

annotations_typeexpr.py:94

-error[invalid-type-form] Invalid subscript of object of type `list[Unknown \| <class 'int'>]` in type expression
-error[invalid-type-form] Int literals are not allowed in this context in a type expression
+error[invalid-type-form] Invalid subscript of object of type `list[<class 'int'>]` in type expression
+error[invalid-type-form] Int literals are not allowed in this context in a type expression

qualifiers_annotated.py:43

-error[invalid-type-form] Invalid subscript of object of type `list[Unknown \| <class 'int'>]` in type expression
-error[invalid-type-form] Int literals are not allowed in this context in a type expression
+error[invalid-type-form] Invalid subscript of object of type `list[<class 'int'>]` in type expression
+error[invalid-type-form] Int literals are not allowed in this context in a type expression

@astral-sh-bot
Copy link

astral-sh-bot bot commented Mar 4, 2026

Memory usage report

Summary

Project Old New Diff Outcome
flake8 48.07MB 47.91MB -0.34% (164.97kB) ⬇️
trio 118.46MB 118.05MB -0.35% (421.61kB) ⬇️
sphinx 266.83MB 265.50MB -0.50% (1.33MB) ⬇️
prefect 698.04MB 693.85MB -0.60% (4.19MB) ⬇️

Significant changes

Click to expand detailed breakdown

flake8

Name Old New Diff Outcome
UnionType<'db>::from_two_elements_ 99.63kB 82.56kB -17.13% (17.07kB) ⬇️
infer_definition_types 1.88MB 1.87MB -0.88% (17.00kB) ⬇️
infer_expression_types_impl 1.07MB 1.06MB -1.41% (15.53kB) ⬇️
is_redundant_with_impl::interned_arguments 158.64kB 143.77kB -9.37% (14.87kB) ⬇️
Type<'db>::apply_specialization_ 226.55kB 216.64kB -4.37% (9.91kB) ⬇️
IntersectionType 83.72kB 74.27kB -11.28% (9.45kB) ⬇️
is_redundant_with_impl 151.28kB 142.49kB -5.81% (8.79kB) ⬇️
StaticClassLiteral<'db>::try_mro_ 343.82kB 335.35kB -2.46% (8.47kB) ⬇️
UnionType 111.19kB 104.89kB -5.66% (6.30kB) ⬇️
infer_deferred_types 695.11kB 690.22kB -0.70% (4.89kB) ⬇️
infer_scope_types_impl 1007.40kB 1002.59kB -0.48% (4.82kB) ⬇️
UnionType<'db>::from_two_elements_::interned_arguments 53.71kB 48.98kB -8.80% (4.73kB) ⬇️
FunctionType 438.02kB 433.78kB -0.97% (4.23kB) ⬇️
Specialization 168.73kB 164.62kB -2.44% (4.11kB) ⬇️
Type<'db>::apply_specialization_::interned_arguments 205.55kB 202.58kB -1.44% (2.97kB) ⬇️
... 28 more

trio

Name Old New Diff Outcome
infer_expression_types_impl 7.15MB 7.06MB -1.26% (92.42kB) ⬇️
infer_expression_type_impl 1.49MB 1.44MB -3.53% (53.78kB) ⬇️
infer_definition_types 7.63MB 7.59MB -0.48% (37.17kB) ⬇️
Type<'db>::apply_specialization_ 767.41kB 737.92kB -3.84% (29.48kB) ⬇️
StaticClassLiteral<'db>::try_mro_ 892.55kB 866.66kB -2.90% (25.90kB) ⬇️
UnionType<'db>::from_two_elements_ 298.23kB 281.39kB -5.64% (16.83kB) ⬇️
is_redundant_with_impl::interned_arguments 572.34kB 556.62kB -2.75% (15.73kB) ⬇️
Type<'db>::class_member_with_policy_ 2.01MB 2.00MB -0.55% (11.39kB) ⬇️
Specialization 486.62kB 475.92kB -2.20% (10.70kB) ⬇️
Type<'db>::apply_specialization_::interned_arguments 656.41kB 645.86kB -1.61% (10.55kB) ⬇️
infer_scope_types_impl 4.80MB 4.79MB -0.20% (9.86kB) ⬇️
IntersectionType 250.42kB 240.65kB -3.90% (9.77kB) ⬇️
is_redundant_with_impl 499.44kB 489.71kB -1.95% (9.73kB) ⬇️
Type<'db>::member_lookup_with_policy_ 1.71MB 1.70MB -0.52% (9.16kB) ⬇️
UnionType 334.80kB 326.41kB -2.51% (8.39kB) ⬇️
... 38 more

sphinx

Name Old New Diff Outcome
infer_expression_types_impl 21.84MB 21.50MB -1.56% (347.86kB) ⬇️
infer_definition_types 24.30MB 24.06MB -1.00% (248.86kB) ⬇️
UnionType<'db>::from_two_elements_ 1.44MB 1.36MB -5.96% (87.99kB) ⬇️
Type<'db>::apply_specialization_ 1.74MB 1.67MB -4.26% (75.80kB) ⬇️
infer_scope_types_impl 15.63MB 15.58MB -0.36% (57.66kB) ⬇️
is_redundant_with_impl::interned_arguments 2.14MB 2.08MB -2.57% (56.20kB) ⬇️
infer_deferred_types 5.65MB 5.60MB -0.96% (55.32kB) ⬇️
StaticClassLiteral<'db>::try_mro_ 2.17MB 2.12MB -2.36% (52.61kB) ⬇️
is_redundant_with_impl 1.86MB 1.81MB -2.38% (45.21kB) ⬇️
IntersectionType 929.75kB 903.48kB -2.83% (26.27kB) ⬇️
Type<'db>::apply_specialization_::interned_arguments 1.48MB 1.46MB -1.72% (26.09kB) ⬇️
UnionType 1.30MB 1.28MB -1.89% (25.14kB) ⬇️
Specialization 1.05MB 1.03MB -2.29% (24.62kB) ⬇️
Type<'db>::class_member_with_policy_ 7.59MB 7.56MB -0.29% (22.49kB) ⬇️
FunctionType 3.15MB 3.13MB -0.63% (20.30kB) ⬇️
... 40 more

prefect

Name Old New Diff Outcome
infer_definition_types 88.36MB 87.33MB -1.16% (1.02MB) ⬇️
infer_expression_types_impl 60.47MB 59.60MB -1.44% (890.70kB) ⬇️
UnionType<'db>::from_two_elements_ 5.56MB 5.15MB -7.30% (415.59kB) ⬇️
infer_scope_types_impl 52.19MB 51.93MB -0.51% (272.86kB) ⬇️
Type<'db>::apply_specialization_ 3.83MB 3.57MB -6.82% (267.33kB) ⬇️
is_redundant_with_impl::interned_arguments 5.60MB 5.37MB -4.04% (231.86kB) ⬇️
infer_deferred_types 14.32MB 14.16MB -1.07% (156.76kB) ⬇️
is_redundant_with_impl 5.69MB 5.55MB -2.31% (134.67kB) ⬇️
IntersectionType 2.45MB 2.33MB -4.79% (120.00kB) ⬇️
UnionType 3.61MB 3.51MB -2.85% (105.31kB) ⬇️
StaticClassLiteral<'db>::try_mro_ 6.13MB 6.07MB -1.09% (68.29kB) ⬇️
UnionType<'db>::from_two_elements_::interned_arguments 2.45MB 2.38MB -2.69% (67.46kB) ⬇️
FunctionType 8.41MB 8.36MB -0.54% (46.47kB) ⬇️
Type<'db>::try_call_dunder_get_ 10.36MB 10.31MB -0.43% (45.52kB) ⬇️
infer_expression_type_impl 14.30MB 14.26MB -0.29% (42.37kB) ⬇️
... 39 more

@astral-sh-bot
Copy link

astral-sh-bot bot commented Mar 4, 2026

mypy_primer results

Changes were detected when running on open source projects
more-itertools (https://github.com/more-itertools/more-itertools)
+ more_itertools/more.py:5433:21: error[invalid-assignment] Invalid subscript assignment with key of type `Literal[1]` and value of type `list[None]` on object of type `list[None]`
- Found 31 diagnostics
+ Found 32 diagnostics

attrs (https://github.com/python-attrs/attrs)
- src/attr/_make.py:2642:33: error[unresolved-attribute] Attribute `name` is not defined on `Attribute` in union `Unknown | Attribute`
- src/attr/_make.py:2644:29: error[unresolved-attribute] Attribute `hash` is not defined on `Attribute` in union `Unknown | Attribute`
+ src/attr/_make.py:2642:33: error[unresolved-attribute] Object of type `Attribute` has no attribute `name`
- src/attr/_make.py:2644:40: error[unresolved-attribute] Attribute `name` is not defined on `Attribute` in union `Unknown | Attribute`
+ src/attr/_make.py:2644:29: error[unresolved-attribute] Object of type `Attribute` has no attribute `hash`
+ src/attr/_make.py:2644:40: error[unresolved-attribute] Object of type `Attribute` has no attribute `name`
- src/attr/exceptions.py:20:34: error[invalid-assignment] Object of type `list[Unknown | str]` is not assignable to `tuple[str]`
+ src/attr/exceptions.py:20:34: error[invalid-assignment] Object of type `list[str]` is not assignable to `tuple[str]`
+ tests/test_converters.py:265:18: error[no-matching-overload] No overload of function `attrib` matches arguments
+ tests/test_converters.py:289:17: error[no-matching-overload] No overload of function `attrib` matches arguments
- tests/test_next_gen.py:445:25: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `dict[Unknown | tuple[int], Unknown | int]`
+ tests/test_next_gen.py:445:25: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `dict[tuple[int], int]`
+ tests/test_setattr.py:124:18: error[no-matching-overload] No overload of function `attrib` matches arguments
+ tests/test_setattr.py:448:17: error[no-matching-overload] No overload of function `field` matches arguments
- tests/test_validators.py:544:24: error[invalid-argument-type] Argument is incorrect: Expected `tuple[Unknown, ...]`, found `list[Unknown | int]`
+ tests/test_validators.py:544:24: error[invalid-argument-type] Argument is incorrect: Expected `tuple[Unknown, ...]`, found `list[int]`
- tests/test_validators.py:555:24: error[invalid-argument-type] Argument is incorrect: Expected `tuple[Unknown, ...]`, found `list[Unknown | int | str]`
+ tests/test_validators.py:555:24: error[invalid-argument-type] Argument is incorrect: Expected `tuple[Unknown, ...]`, found `list[int | str]`
- Found 640 diagnostics
+ Found 644 diagnostics

aioredis (https://github.com/aio-libs/aioredis)
+ aioredis/client.py:536:5: error[unsupported-operator] Operator `+=` is not supported between objects of type `list[(x) -> Unknown]` and `list[(...) -> Unknown]`
+ aioredis/client.py:1470:25: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `str | int`, found `Literal[b"ERROR"]`
+ aioredis/connection.py:288:23: error[no-matching-overload] No overload of bound method `get` matches arguments
- aioredis/connection.py:441:16: error[invalid-return-type] Return type does not match returned value: expected `bytes | memoryview[int] | str | ... omitted 4 union elements`, found `int | list[Unknown | bytes | memoryview[int] | ... omitted 5 union elements] | bytes | ... omitted 3 union elements`
+ aioredis/connection.py:441:16: error[invalid-return-type] Return type does not match returned value: expected `bytes | memoryview[int] | str | ... omitted 4 union elements`, found `int | list[bytes | memoryview[int] | str | ... omitted 4 union elements] | bytes | ... omitted 3 union elements`
+ aioredis/connection.py:516:23: error[no-matching-overload] No overload of bound method `get` matches arguments
- Found 31 diagnostics
+ Found 35 diagnostics

paroxython (https://github.com/laowantong/paroxython)
+ paroxython/derived_labels_db.py:221:21: error[invalid-argument-type] Argument to bound method `extend` is incorrect: Expected `Iterable[list[LiteralString]]`, found `list[list[str]]`
- Found 7 diagnostics
+ Found 8 diagnostics

pyinstrument (https://github.com/joerick/pyinstrument)
- pyinstrument/context_manager.py:40:34: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int | float`, found `Unknown | None`
+ pyinstrument/context_manager.py:40:34: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int | float`, found `@Todo | None`
- pyinstrument/context_manager.py:40:34: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Literal["enabled", "disabled", "strict"]`, found `Unknown | None`
+ pyinstrument/context_manager.py:40:34: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Literal["enabled", "disabled", "strict"]`, found `@Todo | None`

pytest-robotframework (https://github.com/detachhead/pytest-robotframework)
+ tests/fixtures/test_python/test_robot_modify_options_hook_listener_instance/conftest.py:29:27: error[invalid-assignment] Invalid assignment to key "listener" with declared type `list[str | Unknown]` on TypedDict `RobotOptions`: value of type `list[Foo]`
- Found 174 diagnostics
+ Found 175 diagnostics

pip (https://github.com/pypa/pip)
+ src/pip/_internal/req/req_file.py:270:39: error[invalid-argument-type] Argument to bound method `update_index_urls` is incorrect: Expected `list[str]`, found `list[str] | list[Unknown] | list[Any & ~AlwaysFalsy]`
+ src/pip/_internal/req/req_file.py:274:13: error[invalid-argument-type] Argument is incorrect: Expected `list[str]`, found `list[str] | list[Unknown] | list[Any & ~AlwaysFalsy]`
+ src/pip/_internal/req/req_uninstall.py:131:48: error[invalid-argument-type] Argument to function `walk` is incorrect: Argument type `Sized` does not satisfy constraints (`str`, `bytes`) of type variable `AnyStr`
- src/pip/_internal/req/req_uninstall.py:132:42: error[invalid-argument-type] Argument to function `norm_join` is incorrect: Expected `str`, found `Unknown | Sized`
+ src/pip/_internal/req/req_uninstall.py:132:42: error[invalid-argument-type] Argument to function `norm_join` is incorrect: Expected `str`, found `Sized`
- src/pip/_internal/req/req_uninstall.py:133:40: error[invalid-argument-type] Argument to function `norm_join` is incorrect: Expected `str`, found `Unknown | Sized`
+ src/pip/_internal/req/req_uninstall.py:133:40: error[invalid-argument-type] Argument to function `norm_join` is incorrect: Expected `str`, found `Sized`
- src/pip/_internal/req/req_uninstall.py:139:27: error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | Sized` and `LiteralString`
+ src/pip/_internal/req/req_uninstall.py:139:27: error[unsupported-operator] Operator `+` is not supported between objects of type `Sized` and `LiteralString`
+ src/pip/_vendor/distlib/resources.py:297:5: error[invalid-assignment] Invalid subscript assignment with key of type `<class 'SourceFileLoader'>` and value of type `<class 'ResourceFinder'>` on object of type `dict[<class 'NoneType'> | <class 'zipimporter'>, <class 'ResourceFinder'> | <class 'ZipResourceFinder'>]`
+ src/pip/_vendor/distlib/resources.py:298:5: error[invalid-assignment] Invalid subscript assignment with key of type `<class 'FileFinder'>` and value of type `<class 'ResourceFinder'>` on object of type `dict[<class 'NoneType'> | <class 'zipimporter'>, <class 'ResourceFinder'> | <class 'ZipResourceFinder'>]`
+ src/pip/_vendor/distlib/resources.py:300:5: error[invalid-assignment] Invalid subscript assignment with key of type `<class 'SourcelessFileLoader'>` and value of type `<class 'ResourceFinder'>` on object of type `dict[<class 'NoneType'> | <class 'zipimporter'>, <class 'ResourceFinder'> | <class 'ZipResourceFinder'>]`
+ src/pip/_vendor/distlib/resources.py:352:35: error[invalid-argument-type] Argument to bound method `get` is incorrect: Expected `<class 'NoneType'> | <class 'zipimporter'>`, found `type[PathEntryFinderProtocol] | <class 'NoneType'>`
- src/pip/_vendor/pygments/lexers/__init__.py:340:12: error[call-non-callable] Object of type `int` is not callable
- src/pip/_vendor/pygments/lexers/__init__.py:340:12: error[call-non-callable] Object of type `float` is not callable
+ src/pip/_vendor/pygments/lexers/__init__.py:340:12: error[call-non-callable] Object of type `int | float` is not callable
+ src/pip/_vendor/pyproject_hooks/_in_process/_in_process.py:383:9: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["missing_hook_name"]` and value of type `(Unknown & ~AlwaysFalsy) | str` on object of type `dict[str, bool | None]`
- src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int | None`, found `Unknown | int | None | str | dict[Unknown | str, Unknown | None]`
+ src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int | None`, found `int | Unknown | None | str | dict[str, None]`
- src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str`, found `Unknown | int | None | str | dict[Unknown | str, Unknown | None]`
+ src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str`, found `int | Unknown | None | str | dict[str, None]`
- src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str | None`, found `Unknown | int | None | str | dict[Unknown | str, Unknown | None]`
+ src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str | None`, found `int | Unknown | None | str | dict[str, None]`
- src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str | None`, found `Unknown | int | None | str | dict[Unknown | str, Unknown | None]`
+ src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str | None`, found `int | Unknown | None | str | dict[str, None]`
- src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | int | None | str | dict[Unknown | str, Unknown | None]`
+ src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `int | Unknown | None | str | dict[str, None]`
- src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str`, found `Unknown | int | None | str | dict[Unknown | str, Unknown | None]`
+ src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str`, found `int | Unknown | None | str | dict[str, None]`
- src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | int | None | str | dict[Unknown | str, Unknown | None]`
+ src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `int | Unknown | None | str | dict[str, None]`
- src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | int | None | str | dict[Unknown | str, Unknown | None]`
+ src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `int | Unknown | None | str | dict[str, None]`
- src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str`, found `Unknown | int | None | str | dict[Unknown | str, Unknown | None]`
+ src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str`, found `int | Unknown | None | str | dict[str, None]`
- src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | int | None | str | dict[Unknown | str, Unknown | None]`
+ src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `int | Unknown | None | str | dict[str, None]`
- src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | int | None | str | dict[Unknown | str, Unknown | None]`
+ src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `int | Unknown | None | str | dict[str, None]`
- src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int | None`, found `Unknown | int | None | str | dict[Unknown | str, Unknown | None]`
+ src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int | None`, found `int | Unknown | None | str | dict[str, None]`
- src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | int | None | str | dict[Unknown | str, Unknown | None]`
+ src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `int | Unknown | None | str | dict[str, None]`
- src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str | None`, found `Unknown | int | None | str | dict[Unknown | str, Unknown | None]`
+ src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str | None`, found `int | Unknown | None | str | dict[str, None]`
- src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str | None`, found `Unknown | int | None | str | dict[Unknown | str, Unknown | None]`
+ src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str | None`, found `int | Unknown | None | str | dict[str, None]`
- src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[str, str]`, found `Unknown | int | None | str | dict[Unknown | str, Unknown | None]`
+ src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `dict[str, str]`, found `int | Unknown | None | str | dict[str, None]`
- src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | int | None | str | dict[Unknown | str, Unknown | None]`
+ src/pip/_vendor/requests/cookies.py:489:29: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `int | Unknown | None | str | dict[str, None]`
+ src/pip/_vendor/rich/console.py:1987:36: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `Styled`, found `ConsoleRenderable`
- src/pip/_vendor/rich/pretty.py:1006:31: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ src/pip/_vendor/rich/segment.py:430:33: error[invalid-argument-type] Argument to bound method `extend` is incorrect: Expected `Iterable[list[Segment]]`, found `list[list[Self@set_shape]]`
+ src/pip/_vendor/rich/table.py:552:25: error[invalid-assignment] Invalid subscript assignment with key of type `int` and value of type `int | Unknown` on object of type `list[int & ~AlwaysFalsy]`
+ src/pip/_vendor/rich/table.py:557:17: error[invalid-argument-type] Argument to bound method `_collapse_widths` is incorrect: Expected `list[int]`, found `list[int & ~AlwaysFalsy]`
+ src/pip/_vendor/rich/table.py:582:69: error[invalid-argument-type] Argument to function `ratio_distribute` is incorrect: Expected `list[int]`, found `list[int & ~AlwaysFalsy] | list[int]`
+ src/pip/_vendor/rich/table.py:585:16: error[invalid-return-type] Return type does not match returned value: expected `list[int]`, found `list[int & ~AlwaysFalsy] | list[int] | list[Unknown]`
- Found 631 diagnostics
+ Found 643 diagnostics

spack (https://github.com/spack/spack)
+ lib/spack/spack/binary_distribution.py:954:21: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `Prefix`, found `str`
+ lib/spack/spack/binary_distribution.py:2610:76: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `MutableMapping[str, str]`, found `Unknown | dict[str, LiteralString]`
+ lib/spack/spack/binary_distribution.py:2632:71: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `MutableMapping[str, str]`, found `Unknown | dict[str, LiteralString]`
+ lib/spack/spack/binary_distribution.py:2775:60: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `MutableMapping[str, str]`, found `Unknown | dict[str, LiteralString]`
+ lib/spack/spack/ci/common.py:713:70: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `MutableMapping[str, str]`, found `dict[str, LiteralString]`
+ lib/spack/spack/cmd/checksum.py:110:25: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `StandardVersion`, found `StandardVersion | GitVersion`
+ lib/spack/spack/cmd/find.py:231:13: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["start_date", "end_date"]` and value of type `datetime` on object of type `dict[str, InstallRecordStatus | None | ((x) -> Unknown) | bool]`
- lib/spack/spack/cmd/mirror.py:380:59: error[invalid-argument-type] Argument to function `comma_or` is incorrect: Expected `Sequence[str]`, found `list[Unknown] | reversed[str]`
+ lib/spack/spack/cmd/mirror.py:380:59: error[invalid-argument-type] Argument to function `comma_or` is incorrect: Expected `Sequence[str]`, found `list[Unknown & ~AlwaysFalsy] | reversed[str]`
+ lib/spack/spack/concretize.py:119:10: error[no-matching-overload] No overload of bound method `get` matches arguments
- lib/spack/spack/config.py:1761:18: error[invalid-argument-type] Argument to function `validate` is incorrect: Expected `dict[str, Any]`, found `None | dict[Unknown | str, Divergent]`
+ lib/spack/spack/config.py:1761:18: error[invalid-argument-type] Argument to function `validate` is incorrect: Expected `dict[str, Any]`, found `None | dict[str, Divergent]`
- lib/spack/spack/fetch_strategy.py:975:73: error[invalid-argument-type] Argument to function `git_clone` is incorrect: Expected `bool`, found `Unknown | None`
+ lib/spack/spack/fetch_strategy.py:975:73: error[invalid-argument-type] Argument to function `git_clone` is incorrect: Expected `bool`, found `Any | None`
- lib/spack/spack/fetch_strategy.py:978:90: error[invalid-argument-type] Argument to function `git_clone` is incorrect: Expected `bool`, found `Unknown | None`
+ lib/spack/spack/fetch_strategy.py:978:90: error[invalid-argument-type] Argument to function `git_clone` is incorrect: Expected `bool`, found `Any | None`
- lib/spack/spack/fetch_strategy.py:982:82: error[invalid-argument-type] Argument to function `git_checkout` is incorrect: Expected `bool`, found `Unknown | None`
+ lib/spack/spack/fetch_strategy.py:982:82: error[invalid-argument-type] Argument to function `git_checkout` is incorrect: Expected `bool`, found `Any | None`
- lib/spack/spack/fetch_strategy.py:1507:42: error[invalid-argument-type] Argument to function `quote` is incorrect: Expected `list[str]`, found `set[Unknown]`
+ lib/spack/spack/fetch_strategy.py:1507:42: error[invalid-argument-type] Argument to function `quote` is incorrect: Expected `list[str]`, found `set[@Todo]`
+ lib/spack/spack/fetch_strategy.py:1562:17: error[no-matching-overload] No overload of bound method `setdefault` matches arguments
- lib/spack/spack/graph.py:131:31: error[unsupported-operator] Operator `in` is not supported between objects of type `Unknown` and `Unknown | None | list[Unknown | list[Unknown]]`
+ lib/spack/spack/graph.py:131:31: error[unsupported-operator] Operator `in` is not supported between objects of type `Unknown` and `Unknown | None | list[list[Unknown]]`
- lib/spack/spack/graph.py:132:17: error[unresolved-attribute] Attribute `index` is not defined on `None` in union `Unknown | None | list[Unknown | list[Unknown]]`
+ lib/spack/spack/graph.py:132:17: error[unresolved-attribute] Attribute `index` is not defined on `None` in union `Unknown | None | list[list[Unknown]]`
- lib/spack/spack/graph.py:136:17: error[unresolved-attribute] Attribute `pop` is not defined on `None` in union `Unknown | None | list[Unknown | list[Unknown]]`
+ lib/spack/spack/graph.py:136:17: error[unresolved-attribute] Attribute `pop` is not defined on `None` in union `Unknown | None | list[list[Unknown]]`
- lib/spack/spack/graph.py:137:17: error[unresolved-attribute] Attribute `insert` is not defined on `None` in union `Unknown | None | list[Unknown | list[Unknown]]`
+ lib/spack/spack/graph.py:137:17: error[unresolved-attribute] Attribute `insert` is not defined on `None` in union `Unknown | None | list[list[Unknown]]`
- lib/spack/spack/graph.py:160:13: error[unresolved-attribute] Attribute `insert` is not defined on `None` in union `Unknown | None | list[Unknown | list[Unknown]]`
+ lib/spack/spack/graph.py:160:13: error[unresolved-attribute] Attribute `insert` is not defined on `None` in union `Unknown | None | list[list[Unknown]]`
- lib/spack/spack/graph.py:224:20: error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `Unknown | None | list[Unknown | list[Unknown]]`
+ lib/spack/spack/graph.py:224:20: error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `Unknown | None | list[list[Unknown]]`
- lib/spack/spack/graph.py:260:39: error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `Unknown | None | list[Unknown | list[Unknown]]`
+ lib/spack/spack/graph.py:260:39: error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `Unknown | None | list[list[Unknown]]`
- lib/spack/spack/graph.py:272:35: error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `Unknown | None | list[Unknown | list[Unknown]]`
+ lib/spack/spack/graph.py:272:35: error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `Unknown | None | list[list[Unknown]]`
- lib/spack/spack/graph.py:285:39: error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `Unknown | None | list[Unknown | list[Unknown]]`
+ lib/spack/spack/graph.py:285:39: error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `Unknown | None | list[list[Unknown]]`
- lib/spack/spack/graph.py:299:39: error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `Unknown | None | list[Unknown | list[Unknown]]`
+ lib/spack/spack/graph.py:299:39: error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `Unknown | None | list[list[Unknown]]`
- lib/spack/spack/llnl/util/filesystem.py:1668:35: error[invalid-argument-type] Argument to function `exists` is incorrect: Expected `int | str | bytes | PathLike[str] | PathLike[bytes]`, found `Unknown | Sized`
+ lib/spack/spack/llnl/util/filesystem.py:1668:35: error[invalid-argument-type] Argument to function `exists` is incorrect: Expected `int | str | bytes | PathLike[str] | PathLike[bytes]`, found `Sized`
- lib/spack/spack/llnl/util/filesystem.py:1674:25: error[invalid-argument-type] Argument to function `move` is incorrect: Expected `str | PathLike[str]`, found `Unknown | Sized`
+ lib/spack/spack/llnl/util/filesystem.py:1674:25: error[invalid-argument-type] Argument to function `move` is incorrect: Expected `str | PathLike[str]`, found `Sized`
- lib/spack/spack/mirrors/mirror.py:129:16: error[invalid-return-type] Return type does not match returned value: expected `bool`, found `Unknown | str`
+ lib/spack/spack/mirrors/mirror.py:129:16: error[invalid-return-type] Return type does not match returned value: expected `bool`, found `Unknown | str | Literal[False]`
+ lib/spack/spack/mirrors/mirror.py:286:13: error[invalid-assignment] Invalid subscript assignment with key of type `str` and value of type `dict[Unknown, Unknown]` on object of type `dict[str, str]`
+ lib/spack/spack/mirrors/mirror.py:299:13: error[invalid-assignment] Invalid subscript assignment with key of type `str` and value of type `dict[str, str]` on object of type `dict[str, str]`
+ lib/spack/spack/repo.py:717:13: error[invalid-argument-type] Argument to function `from_descriptors` is incorrect: Expected `dict[str, Any] | None`, found `dict[str & ~Literal["all"], Any]`
+ lib/spack/spack/solver/asp.py:3353:12: error[invalid-return-type] Return type does not match returned value: expected `list[str]`, found `list[str & ~AlwaysFalsy]`
- lib/spack/spack/solver/requirements.py:251:49: error[invalid-argument-type] Argument to function `parse_spec_from_yaml_string` is incorrect: Expected `str`, found `Unknown | list[Unknown]`
+ lib/spack/spack/solver/requirements.py:251:49: error[invalid-argument-type] Argument to function `parse_spec_from_yaml_string` is incorrect: Expected `str`, found `Unknown | list[Unknown & str]`
- lib/spack/spack/solver/requirements.py:255:52: error[invalid-argument-type] Argument to function `parse_spec_from_yaml_string` is incorrect: Expected `str`, found `(Unknown & ~AlwaysFalsy) | (list[Unknown] & ~AlwaysFalsy)`
+ lib/spack/spack/solver/requirements.py:255:52: error[invalid-argument-type] Argument to function `parse_spec_from_yaml_string` is incorrect: Expected `str`, found `(Unknown & ~AlwaysFalsy) | (list[Unknown & str] & ~AlwaysFalsy)`
- lib/spack/spack/solver/requirements.py:271:25: error[invalid-argument-type] Argument is incorrect: Expected `str | None`, found `Unknown | list[Unknown] | None`
+ lib/spack/spack/solver/requirements.py:271:25: error[invalid-argument-type] Argument is incorrect: Expected `str | None`, found `Unknown | list[Unknown & str] | None`
- lib/spack/spack/test/buildtask.py:22:28: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `PackageBase`, found `Unknown | None | str`
+ lib/spack/spack/test/buildtask.py:22:28: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `PackageBase`, found `None | str`
- lib/spack/spack/test/cmd/checksum.py:279:39: error[invalid-argument-type] Argument to function `interactive_version_filter` is incorrect: Expected `dict[StandardVersion, str]`, found `dict[Unknown | StandardVersion | GitVersion, Unknown | str]`
+ lib/spack/spack/test/cmd/checksum.py:279:39: error[invalid-argument-type] Argument to function `interactive_version_filter` is incorrect: Expected `dict[StandardVersion, str]`, found `dict[StandardVersion | GitVersion, str]`
- lib/spack/spack/test/cmd/ci.py:2031:57: error[invalid-argument-type] Argument to function `validate_standard_versions` is incorrect: Expected `list[StandardVersion]`, found `list[Unknown | StandardVersion | GitVersion]`
+ lib/spack/spack/test/cmd/ci.py:2031:57: error[invalid-argument-type] Argument to function `validate_standard_versions` is incorrect: Expected `list[StandardVersion]`, found `list[StandardVersion | GitVersion]`
- lib/spack/spack/test/cmd/ci.py:2046:57: error[invalid-argument-type] Argument to function `validate_standard_versions` is incorrect: Expected `list[StandardVersion]`, found `list[Unknown | StandardVersion | GitVersion]`
+ lib/spack/spack/test/cmd/ci.py:2046:57: error[invalid-argument-type] Argument to function `validate_standard_versions` is incorrect: Expected `list[StandardVersion]`, found `list[StandardVersion | GitVersion]`
- lib/spack/spack/test/cmd/ci.py:2070:52: error[invalid-argument-type] Argument to function `validate_git_versions` is incorrect: Expected `list[StandardVersion]`, found `list[Unknown | StandardVersion | GitVersion]`
+ lib/spack/spack/test/cmd/ci.py:2070:52: error[invalid-argument-type] Argument to function `validate_git_versions` is incorrect: Expected `list[StandardVersion]`, found `list[StandardVersion | GitVersion]`
- lib/spack/spack/test/cmd/ci.py:2094:52: error[invalid-argument-type] Argument to function `validate_git_versions` is incorrect: Expected `list[StandardVersion]`, found `list[Unknown | StandardVersion | GitVersion]`
+ lib/spack/spack/test/cmd/ci.py:2094:52: error[invalid-argument-type] Argument to function `validate_git_versions` is incorrect: Expected `list[StandardVersion]`, found `list[StandardVersion | GitVersion]`
- lib/spack/spack/test/cmd/ci.py:2122:52: error[invalid-argument-type] Argument to function `validate_git_versions` is incorrect: Expected `list[StandardVersion]`, found `list[Unknown | StandardVersion | GitVersion]`
+ lib/spack/spack/test/cmd/ci.py:2122:52: error[invalid-argument-type] Argument to function `validate_git_versions` is incorrect: Expected `list[StandardVersion]`, found `list[StandardVersion | GitVersion]`
+ lib/spack/spack/test/cmd/env.py:1754:17: error[invalid-argument-type] Argument to bound method `extend` is incorrect: Expected `Iterable[Unknown & ~AlwaysFalsy]`, found `list[str]`
+ lib/spack/spack/test/cmd/env.py:2216:5: error[no-matching-overload] No overload of bound method `update` matches arguments
+ lib/spack/spack/test/concretization/core.py:2326:9: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["require"]` and value of type `Literal["multi-provider-mpi"]` on object of type `dict[str, bool]`
+ lib/spack/spack/test/concretization/errors.py:89:57: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `list[tuple[Spec, Spec | None]]`, found `list[tuple[Spec, Spec] | tuple[Spec, None]]`
- lib/spack/spack/test/directives.py:121:5: error[invalid-assignment] Object of type `dict[Unknown | Spec, Unknown | str]` is not assignable to attribute `licenses` of type `property`
+ lib/spack/spack/test/directives.py:121:5: error[invalid-assignment] Object of type `dict[Spec, str]` is not assignable to attribute `licenses` of type `property`
- lib/spack/spack/test/directives.py:135:5: error[invalid-assignment] Object of type `dict[Unknown | Spec, Unknown | str]` is not assignable to attribute `licenses` of type `property`
+ lib/spack/spack/test/directives.py:135:5: error[invalid-assignment] Object of type `dict[Spec, str]` is not assignable to attribute `licenses` of type `property`
- lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | list[Unknown]`
+ lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `list[Unknown]`
- lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | list[Unknown]`
+ lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `list[Unknown]`
- lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | list[Unknown]`
+ lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `list[Unknown]`
- lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | list[Unknown]`
+ lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `list[Unknown]`
- lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | list[Unknown]`
+ lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `list[Unknown]`
- lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | list[Unknown]`
+ lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `list[Unknown]`
- lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | list[Unknown]`
+ lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `list[Unknown]`
- lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | list[Unknown]`
+ lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `list[Unknown]`
- lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | list[Unknown]`
+ lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `list[Unknown]`
- lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | list[Unknown]`
+ lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `list[Unknown]`
- lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | list[Unknown]`
+ lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `list[Unknown]`
- lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str | None`, found `Unknown | list[Unknown]`
+ lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str | None`, found `list[Unknown]`
- lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str | None`, found `Unknown | list[Unknown]`
+ lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str | None`, found `list[Unknown]`
- lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool | None`, found `Unknown | list[Unknown]`
+ lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool | None`, found `list[Unknown]`
- lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `Unknown | list[Unknown]`
+ lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `bool`, found `list[Unknown]`
- lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int | None`, found `Unknown | list[Unknown]`
+ lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int | None`, found `list[Unknown]`
- lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Literal["auto", "cache_only", "source_only"]`, found `Unknown | list[Unknown]`
+ lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Literal["auto", "cache_only", "source_only"]`, found `list[Unknown]`
- lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Literal["auto", "cache_only", "source_only"]`, found `Unknown | list[Unknown]`
+ lib/spack/spack/test/install.py:174:54: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Literal["auto", "cache_only", "source_only"]`, found `list[Unknown]`
- lib/spack/spack/test/installer_tui.py:532:30: error[invalid-argument-type] Argument to bound method `add_build` is incorrect: Expected `Spec`, found `Unknown | MockSpec`
+ lib/spack/spack/test/installer_tui.py:532:30: error[invalid-argument-type] Argument to bound method `add_build` is incorrect: Expected `Spec`, found `MockSpec`
- lib/spack/spack/test/installer_tui.py:587:30: error[invalid-argument-type] Argument to bound method `add_build` is incorrect: Expected `Spec`, found `Unknown | MockSpec`
+ lib/spack/spack/test/installer_tui.py:587:30: error[invalid-argument-type] Argument to bound method `add_build` is incorrect: Expected `Spec`, found `MockSpec`
- lib/spack/spack/test/installer_tui.py:932:30: error[invalid-argument-type] Argument to bound method `add_build` is incorrect: Expected `Spec`, found `Unknown | MockSpec`
+ lib/spack/spack/test/installer_tui.py:932:30: error[invalid-argument-type] Argument to bound method `add_build` is incorrect: Expected `Spec`, found `MockSpec`
- lib/spack/spack/test/installer_tui.py:969:30: error[invalid-argument-type] Argument to bound method `add_build` is incorrect: Expected `Spec`, found `Unknown | MockSpec`
+ lib/spack/spack/test/installer_tui.py:969:30: error[invalid-argument-type] Argument to bound method `add_build` is incorrect: Expected `Spec`, found `MockSpec`
- lib/spack/spack/test/installer_tui.py:1013:30: error[invalid-argument-type] Argument to bound method `add_build` is incorrect: Expected `Spec`, found `Unknown | MockSpec`
+ lib/spack/spack/test/installer_tui.py:1013:30: error[invalid-argument-type] Argument to bound method `add_build` is incorrect: Expected `Spec`, found `MockSpec`
- lib/spack/spack/test/llnl/util/lock.py:209:59: error[invalid-argument-type] Argument to function `_poll_interval_generator` is incorrect: Expected `tuple[int | float, int | float, int | float] | None`, found `list[Unknown | int]`
+ lib/spack/spack/test/llnl/util/lock.py:209:59: error[invalid-argument-type] Argument to function `_poll_interval_generator` is incorrect: Expected `tuple[int | float, int | float, int | float] | None`, found `list[int]`
- lib/spack/spack/test/repo.py:706:58: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- lib/spack/spack/test/repo.py:707:58: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- lib/spack/spack/test/repo.py:708:58: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- lib/spack/spack/test/repo.py:799:58: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- lib/spack/spack/test/repo.py:800:58: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- lib/spack/spack/test/repo.py:801:58: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- lib/spack/spack/test/repo.py:802:58: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- lib/spack/spack/test/repo.py:894:58: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- lib/spack/spack/test/spec_semantics.py:2126:16: error[unsupported-operator] Operator `<=` is not supported between two objects of type `Unknown | Spec`
+ lib/spack/spack/test/spec_semantics.py:2126:16: error[unsupported-operator] Operator `<=` is not supported between two objects of type `Spec`
- lib/spack/spack/test/spec_semantics.py:2127:17: error[unsupported-operator] Operator `<` is not supported between two objects of type `Unknown | Spec`
+ lib/spack/spack/test/spec_semantics.py:2127:17: error[unsupported-operator] Operator `<` is not supported between two objects of type `Spec`
- lib/spack/spack/test/spec_semantics.py:2128:16: error[unsupported-operator] Operator `>=` is not supported between two objects of type `Unknown | Spec`
+ lib/spack/spack/test/spec_semantics.py:2128:16: error[unsupported-operator] Operator `>=` is not supported between two objects of type `Spec`
- lib/spack/spack/test/spec_semantics.py:2129:17: error[unsupported-operator] Operator `>` is not supported between two objects of type `Unknown | Spec`
+ lib/spack/spack/test/spec_semantics.py:2129:17: error[unsupported-operator] Operator `>` is not supported between two objects of type `Spec`
+ lib/spack/spack/vendor/altgraph/GraphAlgo.py:159:25: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `tuple[Unknown, Unknown]`, found `None`
+ lib/spack/spack/vendor/attr/_compat.py:122:17: error[invalid-argument-type] Argument to bound method `extend` is incorrect: Expected `Iterable[int]`, found `list[int | bytes | tuple[Any, ...] | tuple[str, ...] | str]`
- lib/spack/spack/vendor/attr/_compat.py:139:53: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `bytes`, found `Unknown | int`
+ lib/spack/spack/vendor/attr/_compat.py:139:53: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `bytes`, found `int`
- lib/spack/spack/vendor/attr/_compat.py:139:53: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `tuple[object, ...]`, found `Unknown | int`
+ lib/spack/spack/vendor/attr/_compat.py:139:53: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `tuple[object, ...]`, found `int`
- lib/spack/spack/vendor/attr/_compat.py:139:53: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `tuple[str, ...]`, found `Unknown | int`
+ lib/spack/spack/vendor/attr/_compat.py:139:53: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `tuple[str, ...]`, found `int`
- lib/spack/spack/vendor/attr/_compat.py:139:53: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `tuple[str, ...]`, found `Unknown | int`
+ lib/spack/spack/vendor/attr/_compat.py:139:53: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `tuple[str, ...]`, found `int`
- lib/spack/spack/vendor/attr/_compat.py:139:53: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `str`, found `Unknown | int`
+ lib/spack/spack/vendor/attr/_compat.py:139:53: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `str`, found `int`
- lib/spack/spack/vendor/attr/_compat.py:139:53: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `str`, found `Unknown | int`
+ lib/spack/spack/vendor/attr/_compat.py:139:53: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `str`, found `int`
- lib/spack/spack/vendor/attr/_compat.py:139:53: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `bytes`, found `Unknown | int`
+ lib/spack/spack/vendor/attr/_compat.py:139:53: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `bytes`, found `int`
- lib/spack/spack/vendor/attr/_compat.py:139:53: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `tuple[str, ...]`, found `Unknown | int`
+ lib/spack/spack/vendor/attr/_compat.py:139:53: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `tuple[str, ...]`, found `int`
- lib/spack/spack/vendor/attr/_compat.py:139:53: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `tuple[str, ...]`, found `Unknown | int`
+ lib/spack/spack/vendor/attr/_compat.py:139:53: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `tuple[str, ...]`, found `int`
- lib/spack/spack/vendor/attr/_make.py:2653:33: error[unresolved-attribute] Attribute `name` is not defined on `Attribute` in union `Unknown | Attribute`
- lib/spack/spack/vendor/attr/_make.py:2655:29: error[unresolved-attribute] Attribute `hash` is not defined on `Attribute` in union `Unknown | Attribute`
+ lib/spack/spack/vendor/attr/_make.py:2653:33: error[unresolved-attribute] Object of type `Attribute` has no attribute `name`
- lib/spack/spack/vendor/attr/_make.py:2655:40: error[unresolved-attribute] Attribute `name` is not defined on `Attribute` in union `Unknown | Attribute`
+ lib/spack/spack/vendor/attr/_make.py:2655:29: error[unresolved-attribute] Object of type `Attribute` has no attribute `hash`
+ lib/spack/spack/vendor/attr/_make.py:2655:40: error[unresolved-attribute] Object of type `Attribute` has no attribute `name`
- lib/spack/spack/vendor/jinja2/compiler.py:1404:50: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- lib/spack/spack/vendor/jinja2/environment.py:499:35: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ lib/spack/spack/vendor/jinja2/ext.py:260:9: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["_"]` and value of type `def _gettext_alias(__context: Context, /, *args: Any, **kwargs: Any) -> Any | Undefined` on object of type `dict[str, <class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements]`
+ lib/spack/spack/vendor/jinja2/ext.py:337:13: error[invalid-argument-type] Argument to bound method `update` is incorrect: Expected `<class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements`, found `((str, /) -> str) | ((...) -> str)`
+ lib/spack/spack/vendor/jinja2/ext.py:337:30: error[invalid-argument-type] Argument to bound method `update` is incorrect: Expected `<class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements`, found `((str, str, int, /) -> str) | ((...) -> str)`
+ lib/spack/spack/vendor/jinja2/ext.py:337:49: error[invalid-argument-type] Argument to bound method `update` is incorrect: Expected `<class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements`, found `((str, str, /) -> str) | None | ((...) -> str)`
+ lib/spack/spack/vendor/jinja2/ext.py:337:68: error[invalid-argument-type] Argument to bound method `update` is incorrect: Expected `<class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements`, found `((str, str, str, int, /) -> str) | None | ((...) -> str)`
+ lib/spack/spack/vendor/jinja2/filters.py:170:13: error[invalid-assignment] Invalid subscript assignment with key of type `int` and value of type `Any | Undefined` on object of type `list[None]`
+ lib/spack/spack/vendor/jinja2/lexer.py:165:16: error[invalid-argument-type] Method `__getitem__` of type `bound method dict[LiteralString, str].__getitem__(key: LiteralString, /) -> str` cannot be called with key of type `str` on object of type `dict[LiteralString, str]`
+ lib/spack/spack/vendor/jinja2/lexer.py:167:12: error[no-matching-overload] No overload of bound method `get` matches arguments
+ lib/spack/spack/vendor/jinja2/nodes.py:215:25: error[invalid-argument-type] Argument to bound method `extend` is incorrect: Expected `Iterable[Self@set_ctx]`, found `Iterator[Node]`
+ lib/spack/spack/vendor/jinja2/nodes.py:226:25: error[invalid-argument-type] Argument to bound method `extend` is incorrect: Expected `Iterable[Self@set_lineno]`, found `Iterator[Node]`
+ lib/spack/spack/vendor/jinja2/nodes.py:235:25: error[invalid-argument-type] Argument to bound method `extend` is incorrect: Expected `Iterable[Self@set_environment]`, found `Iterator[Node]`
+ lib/spack/spack/vendor/jinja2/sandbox.py:254:9: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["range"]` and value of type `def safe_range(*args: int) -> range` on object of type `dict[str, <class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements]`
+ lib/spack/spack/vendor/pyrsistent/_pmap.py:430:13: error[invalid-assignment] Invalid subscript assignment with key of type `int` and value of type `list[tuple[Unknown, Unknown]]` on object of type `list[None]`
- lib/spack/spack/vendor/ruamel/yaml/emitter.py:1019:27: error[unresolved-attribute] Attribute `keys` is not defined on `None` in union `Unknown | None | dict[Unknown | str, Unknown | str]`
+ lib/spack/spack/vendor/ruamel/yaml/emitter.py:1019:27: error[unresolved-attribute] Attribute `keys` is not defined on `None` in union `Unknown | None | dict[str, str]`
+ lib/spack/spack/vendor/ruamel/yaml/resolver.py:156:35: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `tuple[list[tuple[int, int]], str, LazyEval, list[str]]`, found `tuple[list[tuple[int, int]], Unknown, Unknown, (Unknown & ~None) | list[None]]`
- lib/spack/spack/vendor/ruamel/yaml/tokens.py:94:40: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- lib/spack/spack/vendor/ruamel/yaml/tokens.py:105:36: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- lib/spack/spack/vendor/ruamel/yaml/tokens.py:117:40: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- lib/spack/spack/verify_libraries.py:170:69: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `list[bytes]`, found `list[Unknown | bytes | str | PathLike[str] | PathLike[bytes]]`
+ lib/spack/spack/verify_libraries.py:170:69: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `list[bytes]`, found `list[bytes | Unknown | str | PathLike[str] | PathLike[bytes]]`
- share/spack/qa/flake8_formatter.py:62:16: error[unresolved-attribute] Attribute `search` is not defined on `str` in union `Unknown | str | Pattern[str]`
+ share/spack/qa/flake8_formatter.py:62:16: error[unresolved-attribute] Attribute `search` is not defined on `str` in union `str | Pattern[str]`
- Found 4401 diagnostics
+ Found 4421 diagnostics

stone (https://github.com/dropbox/stone)
- stone/backends/python_rsrc/stone_validators.py:714:16: error[invalid-exception-caught] Invalid object caught in an exception handler: Object has type `list[Unknown | <class 'AttributeError'> | <class 'ValueError'>]`
+ stone/backends/python_rsrc/stone_validators.py:714:16: error[invalid-exception-caught] Invalid object caught in an exception handler: Object has type `list[<class 'AttributeError'> | <class 'ValueError'>]`

jinja (https://github.com/pallets/jinja)
+ examples/basic/translate.py:4:1: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["gettext"]` and value of type `bound method dict[str, str].__getitem__(key: str, /) -> str` on object of type `dict[str, <class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements]`
+ examples/basic/translate.py:5:1: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["ngettext"]` and value of type `(s, p, n) -> Unknown` on object of type `dict[str, <class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements]`
- src/jinja2/compiler.py:1422:50: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/jinja2/environment.py:514:35: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ src/jinja2/ext.py:258:9: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["_"]` and value of type `def _gettext_alias(__context: Context, /, *args: Any, **kwargs: Any) -> Any | Undefined` on object of type `dict[str, <class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements]`
+ src/jinja2/ext.py:319:13: error[invalid-argument-type] Argument to bound method `update` is incorrect: Expected `<class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements`, found `((str, /) -> str) | ((...) -> str)`
+ src/jinja2/ext.py:319:30: error[invalid-argument-type] Argument to bound method `update` is incorrect: Expected `<class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements`, found `((str, str, int, /) -> str) | ((...) -> str)`
+ src/jinja2/ext.py:319:49: error[invalid-argument-type] Argument to bound method `update` is incorrect: Expected `<class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements`, found `((str, str, /) -> str) | None | ((...) -> str)`
+ src/jinja2/ext.py:319:68: error[invalid-argument-type] Argument to bound method `update` is incorrect: Expected `<class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements`, found `((str, str, str, int, /) -> str) | None | ((...) -> str)`
+ src/jinja2/filters.py:120:13: error[invalid-assignment] Invalid subscript assignment with key of type `int` and value of type `Any | Undefined` on object of type `list[None]`
+ src/jinja2/lexer.py:167:16: error[invalid-argument-type] Method `__getitem__` of type `bound method dict[LiteralString, str].__getitem__(key: LiteralString, /) -> str` cannot be called with key of type `str` on object of type `dict[LiteralString, str]`
+ src/jinja2/lexer.py:169:12: error[no-matching-overload] No overload of bound method `get` matches arguments
+ src/jinja2/nodes.py:217:25: error[invalid-argument-type] Argument to bound method `extend` is incorrect: Expected `Iterable[Self@set_ctx]`, found `Iterator[Node]`
+ src/jinja2/nodes.py:228:25: error[invalid-argument-type] Argument to bound method `extend` is incorrect: Expected `Iterable[Self@set_lineno]`, found `Iterator[Node]`
+ src/jinja2/nodes.py:237:25: error[invalid-argument-type] Argument to bound method `extend` is incorrect: Expected `Iterable[Self@set_environment]`, found `Iterator[Node]`
+ src/jinja2/sandbox.py:244:9: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["range"]` and value of type `def safe_range(*args: int) -> range` on object of type `dict[str, <class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements]`
+ tests/test_async.py:123:5: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["bar"]` and value of type `Literal[23]` on object of type `dict[str, <class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements]`
+ tests/test_async.py:655:5: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["add_each"]` and value of type `(v, x) -> Unknown` on object of type `dict[str, <class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements]`
+ tests/test_ext.py:122:1: error[no-matching-overload] No overload of bound method `update` matches arguments
+ tests/test_ext.py:134:1: error[no-matching-overload] No overload of bound method `update` matches arguments
+ tests/test_ext.py:291:9: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["gettext"]` and value of type `(x) -> Unknown` on object of type `dict[str, <class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements]`
+ tests/test_imports.py:22:5: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["bar"]` and value of type `Literal[23]` on object of type `dict[str, <class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements]`
+ tests/test_lexnparse.py:320:9: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["foo"]` and value of type `(a, b, c, e, g) -> Unknown` on object of type `dict[str, <class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements]`
+ tests/test_regression.py:354:9: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["get_int"]` and value of type `() -> Unknown` on object of type `dict[str, <class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements]`
+ tests/test_regression.py:711:9: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["x"]` and value of type `Literal["x"]` on object of type `dict[str, <class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements]`
+ tests/test_regression.py:712:9: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["y"]` and value of type `Literal["y"]` on object of type `dict[str, <class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements]`
- Found 181 diagnostics
+ Found 203 diagnostics

asynq (https://github.com/quora/asynq)
- asynq/tests/test_tools.py:129:30: error[invalid-argument-type] Argument to bound method `__call__` is incorrect: Expected `((Unknown | int, /) -> Any) | None`, found `list[Unknown | int]`
+ asynq/tests/test_tools.py:129:30: error[invalid-argument-type] Argument to bound method `__call__` is incorrect: Expected `((int, /) -> Any) | None`, found `list[int]`
- asynq/tests/test_typing.py:62:34: error[invalid-argument-type] Argument to bound method `__call__` is incorrect: Expected `((Unknown | int | Sized, /) -> Any) | None`, found `def len(obj: Sized, /) -> int`
+ asynq/tests/test_typing.py:62:34: error[invalid-argument-type] Argument to bound method `__call__` is incorrect: Expected `((int | Sized, /) -> Any) | None`, found `def len(obj: Sized, /) -> int`

yarl (https://github.com/aio-libs/yarl)
- tests/test_pickle.py:29:20: error[invalid-argument-type] Argument to bound method `__setstate__` is incorrect: Expected `tuple[tuple[str, str, str, str, str]] | tuple[None, _InternalURLCache]`, found `tuple[None, dict[Unknown | str, Unknown | tuple[str, str, str, str, str]]]`
+ tests/test_pickle.py:29:20: error[invalid-argument-type] Argument to bound method `__setstate__` is incorrect: Expected `tuple[tuple[str, str, str, str, str]] | tuple[None, _InternalURLCache]`, found `tuple[None, dict[str, tuple[str, str, str, str, str]]]`

werkzeug (https://github.com/pallets/werkzeug)
- src/werkzeug/exceptions.py:94:67: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ src/werkzeug/routing/rules.py:774:21: error[invalid-assignment] Object of type `(list[expr] & ~AlwaysFalsy) | list[Constant]` is not assignable to `list[expr]`
+ src/werkzeug/security.py:199:22: error[invalid-argument-type] Argument to bound method `append` is incorrect: Expected `str & ~AlwaysFalsy`, found `str & ~Literal[".."]`
- src/werkzeug/test.py:409:20: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str`, found `Unknown | str | None | Headers`
+ src/werkzeug/test.py:409:20: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str`, found `str | Any | None | Headers`
- src/werkzeug/test.py:409:20: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str | None`, found `Unknown | str | None | Headers`
+ src/werkzeug/test.py:409:20: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str | None`, found `str | Any | None | Headers`
- src/werkzeug/test.py:409:20: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Mapping[str, str] | str | None`, found `Unknown | str | None | Headers`
+ src/werkzeug/test.py:409:20: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Mapping[str, str] | str | None`, found `str | Any | 

... (truncated 8948 lines) ...

@carljm carljm force-pushed the cjm/remove-container-literal-unknown branch from 03b7cec to 35e5f43 Compare March 4, 2026 22:17
@astral-sh-bot
Copy link

astral-sh-bot bot commented Mar 4, 2026

ecosystem-analyzer results

Lint rule Added Removed Changed
invalid-argument-type 996 247 1,728
invalid-assignment 688 9 185
unsupported-operator 38 16 325
unresolved-attribute 25 8 304
type-assertion-failure 30 101 60
no-matching-overload 170 0 0
invalid-return-type 48 0 66
unused-type-ignore-comment 2 58 0
invalid-parameter-default 0 0 34
not-iterable 1 0 32
redundant-cast 10 0 0
call-non-callable 1 3 4
not-subscriptable 0 0 7
unsupported-base 4 0 0
division-by-zero 0 2 0
invalid-declaration 1 0 1
assert-type-unspellable-subtype 1 0 0
call-top-callable 1 0 0
invalid-exception-caught 0 0 1
possibly-unresolved-reference 0 1 0
Total 2,016 445 2,747

Full report with detailed diff (timing results)

@astral-sh-bot
Copy link

astral-sh-bot bot commented Mar 4, 2026

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@carljm carljm force-pushed the cjm/remove-container-literal-unknown branch from 09fcc93 to 24e967a Compare March 4, 2026 22:37
@carljm carljm marked this pull request as ready for review March 5, 2026 00:23
Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

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

This makes sense to me (though seems unlikely that I should be the sole approver here).

Copy link
Member

@dcreager dcreager left a comment

Choose a reason for hiding this comment

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

We've discussed this extensively as a team, so 👍 to change. And thank you for the thorough ecosystem analysis analysis! I agree with all of your suggestions for punting things to follow-on work.

Comment on lines -12147 to +12155
// If a valid type annotation was not provided, avoid restricting the type of the
// collection by unioning the inferred type with `Unknown`.
let elt_tcx = elt_tcx.unwrap_or(Type::unknown());

builder
.infer(&constraints, Type::TypeVar(elt_ty), elt_tcx)
.ok()?;
// If there is no applicable context for this element type variable, we infer from the
// literal elements directly. This violates the gradual guarantee (we don't know that
// our inference is compatible with subsequent additions to the collection), but it
// matches the behavior of other type checkers and is usually the desired behavior.
if let Some(elt_tcx) = elt_tcx {
builder
.infer(&constraints, Type::TypeVar(elt_ty), elt_tcx)
.ok()?;
}
Copy link
Member

Choose a reason for hiding this comment

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

A truly overwhelming amount of code diff to review here 😂

* main:
  Update conformance suite commit hash (#23746)
  conformance.py: Collapse the summary paragraph when nothing changed (#23745)
  [ty] Make inferred specializations line up with source types more better (#23715)
  Bump 0.15.5 (#23743)
  [ty] Render all changed diagnostics in conformance.py (#23613)
  [ty] Split deferred checks out of `types/infer/builder.rs` (#23740)
  Discover markdown files by default in preview mode (#23434)
  [ty] Use `HasOptionalDefinition` for `except` handlers (#23739)
  [ty] Fix precedence of `all` selector in TOML configurations (#23723)
  [ty] Make `all` selector case sensitive (#23713)
  [ty] Add a diagnostic if a `TypeVar` is used to specialize a `ParamSpec`, or vice versa (#23738)
  [ty] Override home directory in ty tests (#23724)
  [ty] More type-variable default validation (#23639)
  [ty] Validate bare ParamSpec usage in type annotations, and support stringified ParamSpecs as the first argument to `Callable` (#23625)
  [ty] Add `all` selector to ty.json's `schema` (#23721)
  [ty] Add quotes to related issues links (#23720)
  [ty] Fix panic on incomplete except handlers (#23708)
@carljm
Copy link
Contributor Author

carljm commented Mar 5, 2026

I have a stacked draft PR implementing the negative-intersection-element removal, and it looks pretty good. I think that's the highest-priority follow-up, so I'll go ahead and land this.

@carljm carljm merged commit 7d8c642 into main Mar 5, 2026
51 checks passed
@carljm carljm deleted the cjm/remove-container-literal-unknown branch March 5, 2026 23:40
carljm added a commit that referenced this pull request Mar 6, 2026
## Summary

Avoid inferring invariant container types like `list[int &
~AlwaysFalsy]`, preferring `list[int]` instead.

Also generally rename "literal promotion" to just "promotion" -- it
already promoted e.g. `float` to `int | float`, so it wasn't restricted
to literal types. Now it includes even more non-literal cases.

## Test Plan

Added an mdtest.

Removes ~200 ecosystem hits from
#23718
@carljm
Copy link
Contributor Author

carljm commented Mar 6, 2026

Landed #23750 as the highest-priority follow-up here, and filed astral-sh/ty#2971 and astral-sh/ty#2972 as additional follow-ups. Marked both as child issues of astral-sh/ty#1473.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ecosystem-analyzer ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants