[ty] Preserve type variables in invariant materialization subtyping - #28072
Draft
sharkdp wants to merge 5 commits into
Draft
[ty] Preserve type variables in invariant materialization subtyping#28072sharkdp wants to merge 5 commits into
sharkdp wants to merge 5 commits into
Conversation
sharkdp
force-pushed
the
codex/invariant-typevar-materializations
branch
from
August 27, 2026 07:03
e8d39af to
55aa8f4
Compare
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 97.79%. The percentage of expected errors that received a diagnostic held steady at 94.33%. The number of fully passing files held steady at 112/136. |
Memory usage reportSummary
Significant changesClick to expand detailed breakdownprefect
trio
sphinx
|
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-argument-type |
18 | 0 | 12 |
invalid-return-type |
8 | 0 | 6 |
invalid-assignment |
4 | 0 | 9 |
invalid-yield |
3 | 0 | 0 |
unsound-return-statement |
2 | 1 | 0 |
no-matching-overload |
1 | 1 | 0 |
type-assertion-failure |
2 | 0 | 0 |
redundant-cast |
0 | 1 | 0 |
unresolved-attribute |
1 | 0 | 0 |
| Total | 39 | 3 | 27 |
Raw diff (69 changes)
anyio (https://github.com/agronholm/anyio)
+ src/anyio/itertools.py:116:13 error[invalid-assignment] Object of type `Top[_TeeState[Unknown]]` is not assignable to attribute `_state` of type `_TeeState[T@_TeeAsyncIterator]`
+ src/anyio/itertools.py:117:13 error[invalid-assignment] Object of type `Top[_TeeLink[Unknown]]` is not assignable to attribute `_link` of type `_TeeLink[T@_TeeAsyncIterator]`
archinstall (https://github.com/archlinux/archinstall)
- archinstall/tui/result.py:71:10 warning[redundant-cast] Value is already of type `list[ValueT@Result]`
cki-lib (https://gitlab.com/cki-project/cki-lib)
+ cki_lib/misc.py:68:24 error[invalid-yield] Yield type `object` does not match annotated yield type `T@flattened`
core (https://github.com/home-assistant/core)
+ homeassistant/components/datadog/__init__.py:85:31 error[invalid-argument-type] Argument to bound method `EventBus.async_listen` is incorrect: Expected `EventType[Mapping[str, Any]] | str`, found `EventType[EventStateChangedData]`
+ homeassistant/components/influxdb/__init__.py:595:35 error[invalid-argument-type] Argument to bound method `EventBus.async_listen` is incorrect: Expected `EventType[Mapping[str, Any]] | str`, found `EventType[EventStateChangedData]`
+ homeassistant/components/statsd/__init__.py:91:21 error[invalid-argument-type] Argument to bound method `EventBus.listen` is incorrect: Expected `EventType[Mapping[str, Any]] | str`, found `EventType[EventStateChangedData]`
- homeassistant/core.py:2482:17 error[invalid-argument-type] Argument to bound method `EventBus.async_fire_internal` is incorrect: Expected `EventType[EventStateReportedData | dict[str, str | datetime | State | None]] | str`, found `EventType[EventStateReportedData]`
+ homeassistant/core.py:2482:17 error[invalid-argument-type] Argument to bound method `EventBus.async_fire_internal` is incorrect: Expected `EventType[dict[str, str | datetime | State | None]] | str`, found `EventType[EventStateReportedData]`
+ homeassistant/helpers/device_registry.py:2941:13 error[invalid-argument-type] Argument to bound method `EventBus.async_fire_internal` is incorrect: Expected `EventType[_EventDeviceRegistryUpdatedData_Update] | str`, found `EventType[EventDeviceRegistryUpdatedData]`
+ homeassistant/helpers/device_registry.py:3432:43 error[invalid-argument-type] Argument to bound method `EventBus.async_fire_internal` is incorrect: Expected `EventType[_EventDeviceRegistryUpdatedData_Create | _EventDeviceRegistryUpdatedData_Update] | str`, found `EventType[EventDeviceRegistryUpdatedData]`
+ homeassistant/helpers/device_registry.py:3615:43 error[invalid-argument-type] Argument to bound method `EventBus.async_fire_internal` is incorrect: Expected `EventType[_EventDeviceRegistryUpdatedData_Create | _EventDeviceRegistryUpdatedData_Update] | str`, found `EventType[EventDeviceRegistryUpdatedData]`
+ homeassistant/helpers/device_registry.py:4104:13 error[invalid-argument-type] Argument to bound method `EventBus.async_fire_internal` is incorrect: Expected `EventType[_EventDeviceRegistryUpdatedData_Remove] | str`, found `EventType[EventDeviceRegistryUpdatedData]`
+ homeassistant/helpers/device_registry.py:4135:13 error[invalid-argument-type] Argument to bound method `EventBus.async_fire_internal` is incorrect: Expected `EventType[_EventDeviceRegistryUpdatedData_Remove] | str`, found `EventType[EventDeviceRegistryUpdatedData]`
+ homeassistant/helpers/entity_registry.py:1616:13 error[invalid-argument-type] Argument to bound method `EventBus.async_fire_internal` is incorrect: Expected `EventType[_EventEntityRegistryUpdatedData_CreateRemove] | str`, found `EventType[EventEntityRegistryUpdatedData]`
+ homeassistant/helpers/entity_registry.py:1664:13 error[invalid-argument-type] Argument to bound method `EventBus.async_fire_internal` is incorrect: Expected `EventType[_EventEntityRegistryUpdatedData_CreateRemove] | str`, found `EventType[EventEntityRegistryUpdatedData]`
+ homeassistant/helpers/entity_registry.py:2014:43 error[invalid-argument-type] Argument to bound method `EventBus.async_fire_internal` is incorrect: Expected `EventType[_EventEntityRegistryUpdatedData_Update] | str`, found `EventType[EventEntityRegistryUpdatedData]`
+ homeassistant/helpers/floor_registry.py:225:13 error[invalid-argument-type] Argument to bound method `EventBus.async_fire_internal` is incorrect: Expected `EventType[_EventFloorRegistryUpdatedData_Create_Remove_Update] | str`, found `EventType[EventFloorRegistryUpdatedData]`
+ homeassistant/helpers/floor_registry.py:238:13 error[invalid-argument-type] Argument to bound method `EventBus.async_fire_internal` is incorrect: Expected `EventType[_EventFloorRegistryUpdatedData_Create_Remove_Update] | str`, found `EventType[EventFloorRegistryUpdatedData]`
+ homeassistant/helpers/floor_registry.py:280:13 error[invalid-argument-type] Argument to bound method `EventBus.async_fire_internal` is incorrect: Expected `EventType[_EventFloorRegistryUpdatedData_Create_Remove_Update] | str`, found `EventType[EventFloorRegistryUpdatedData]`
+ homeassistant/helpers/floor_registry.py:307:13 error[invalid-argument-type] Argument to bound method `EventBus.async_fire_internal` is incorrect: Expected `EventType[_EventFloorRegistryUpdatedData_Reorder] | str`, found `EventType[EventFloorRegistryUpdatedData]`
- homeassistant/scripts/benchmark/__init__.py:143:29 error[invalid-argument-type] Argument to bound method `EventBus.async_fire` is incorrect: Expected `EventType[EventStateChangedData | dict[str, str | State]] | str`, found `EventType[EventStateChangedData]`
+ homeassistant/scripts/benchmark/__init__.py:143:29 error[invalid-argument-type] Argument to bound method `EventBus.async_fire` is incorrect: Expected `EventType[dict[str, str | State]] | str`, found `EventType[EventStateChangedData]`
- homeassistant/scripts/benchmark/__init__.py:176:29 error[invalid-argument-type] Argument to bound method `EventBus.async_fire` is incorrect: Expected `EventType[EventStateChangedData | dict[str, str | State]] | str`, found `EventType[EventStateChangedData]`
+ homeassistant/scripts/benchmark/__init__.py:176:29 error[invalid-argument-type] Argument to bound method `EventBus.async_fire` is incorrect: Expected `EventType[dict[str, str | State]] | str`, found `EventType[EventStateChangedData]`
- homeassistant/scripts/benchmark/__init__.py:214:29 error[invalid-argument-type] Argument to bound method `EventBus.async_fire` is incorrect: Expected `EventType[EventStateChangedData | dict[str, str | State]] | str`, found `EventType[EventStateChangedData]`
+ homeassistant/scripts/benchmark/__init__.py:214:29 error[invalid-argument-type] Argument to bound method `EventBus.async_fire` is incorrect: Expected `EventType[dict[str, str | State]] | str`, found `EventType[EventStateChangedData]`
discord.py (https://github.com/Rapptz/discord.py)
+ discord/ext/commands/cog.py:461:32 error[invalid-yield] Yield type `Top[Command[Unknown, (...), Any]]` does not match annotated yield type `Command[Self@walk_commands, (...), Any]`
+ discord/ext/commands/core.py:1455:28 error[invalid-yield] Yield type `Top[Command[Unknown, (...), Any]]` does not match annotated yield type `Command[CogT@GroupMixin, (...), Any]`
+ discord/ext/commands/core.py:1499:16 error[invalid-return-type] Return type does not match returned value: expected `Command[CogT@GroupMixin, (...), Any] | None`, found `Top[Command[Unknown, (...), Any]] | Unknown`
meson (https://github.com/mesonbuild/meson)
+ mesonbuild/modules/hotdoc.py:61:12 error[invalid-return-type] Return type does not match returned value: expected `list[_T@ensure_list]`, found `(_T@ensure_list & Top[list[Unknown]]) | list[_T@ensure_list]`
+ mesonbuild/utils/universal.py:1912:12 error[invalid-return-type] Return type does not match returned value: expected `list[_T@typeslistify]`, found `(_T@typeslistify & Top[list[Unknown]]) | Top[list[Unknown & _T@typeslistify]]`
mkdocs (https://github.com/mkdocs/mkdocs)
+ mkdocs/config/config_options.py:219:20 error[invalid-return-type] Return type does not match returned value: expected `list[T@ListOfItems]`, found `Top[list[Unknown]] & ~AlwaysTruthy`
optuna (https://github.com/optuna/optuna)
- optuna/storages/_rdb/alembic/versions/v1.3.0.a.py:63:59 error[invalid-argument-type] Argument to function `loads` is incorrect: Expected `str | bytes | bytearray`, found `Column[str]`
+ optuna/storages/_rdb/alembic/versions/v1.3.0.a.py:63:59 error[invalid-argument-type] Argument to function `loads` is incorrect: Expected `str | bytes | bytearray`, found `Column[Unknown]`
- optuna/storages/_rdb/alembic/versions/v3.0.0.a.py:158:13 error[invalid-assignment] Object of type `str` is not assignable to attribute `distribution_json` of type `Column[str]`
+ optuna/storages/_rdb/alembic/versions/v3.0.0.a.py:158:13 error[invalid-assignment] Object of type `str` is not assignable to attribute `distribution_json` of type `Column[Unknown]`
- optuna/storages/_rdb/alembic/versions/v3.0.0.a.py:159:17 error[invalid-argument-type] Argument to function `migrate_new_distribution` is incorrect: Expected `str`, found `Column[str]`
+ optuna/storages/_rdb/alembic/versions/v3.0.0.a.py:159:17 error[invalid-argument-type] Argument to function `migrate_new_distribution` is incorrect: Expected `str`, found `Column[Unknown]`
- optuna/storages/_rdb/alembic/versions/v3.0.0.a.py:187:13 error[invalid-assignment] Object of type `str` is not assignable to attribute `distribution_json` of type `Column[str]`
+ optuna/storages/_rdb/alembic/versions/v3.0.0.a.py:187:13 error[invalid-assignment] Object of type `str` is not assignable to attribute `distribution_json` of type `Column[Unknown]`
- optuna/storages/_rdb/alembic/versions/v3.0.0.a.py:188:17 error[invalid-argument-type] Argument to function `restore_old_distribution` is incorrect: Expected `str`, found `Column[str]`
+ optuna/storages/_rdb/alembic/versions/v3.0.0.a.py:188:17 error[invalid-argument-type] Argument to function `restore_old_distribution` is incorrect: Expected `str`, found `Column[Unknown]`
- optuna/storages/_rdb/alembic/versions/v3.0.0.c.py:128:25 error[invalid-assignment] Object of type `Column[float]` is not assignable to `float`
+ optuna/storages/_rdb/alembic/versions/v3.0.0.c.py:128:25 error[invalid-assignment] Object of type `Column[Unknown]` is not assignable to `float`
- optuna/storages/_rdb/alembic/versions/v3.0.0.d.py:132:25 error[invalid-assignment] Object of type `Column[float]` is not assignable to `float`
+ optuna/storages/_rdb/alembic/versions/v3.0.0.d.py:132:25 error[invalid-assignment] Object of type `Column[Unknown]` is not assignable to `float`
- optuna/storages/_rdb/storage.py:342:17 error[invalid-assignment] Invalid assignment to data descriptor attribute `value_json` on type `StudyUserAttributeModel`: Argument type `MappedColumn[Any] | Column[str]` does not satisfy upper bound `Mapped[Any]` of type variable `Self`
+ optuna/storages/_rdb/storage.py:342:17 error[invalid-assignment] Invalid assignment to data descriptor attribute `value_json` on type `StudyUserAttributeModel`: Argument type `MappedColumn[Any] | Column[Unknown]` does not satisfy upper bound `Mapped[Any]` of type variable `Self`
- optuna/storages/_rdb/storage.py:354:17 error[invalid-assignment] Invalid assignment to data descriptor attribute `value_json` on type `StudySystemAttributeModel`: Argument type `MappedColumn[Any] | Column[str]` does not satisfy upper bound `Mapped[Any]` of type variable `Self`
+ optuna/storages/_rdb/storage.py:354:17 error[invalid-assignment] Invalid assignment to data descriptor attribute `value_json` on type `StudySystemAttributeModel`: Argument type `MappedColumn[Any] | Column[Unknown]` does not satisfy upper bound `Mapped[Any]` of type variable `Self`
- optuna/storages/_rdb/storage.py:368:16 error[invalid-return-type] Return type does not match returned value: expected `str`, found `Any | Column[str]`
+ optuna/storages/_rdb/storage.py:368:16 error[invalid-return-type] Return type does not match returned value: expected `str`, found `Any | Column[Unknown]`
- optuna/storages/_rdb/storage.py:382:48 error[invalid-argument-type] Argument to function `loads` is incorrect: Expected `str | bytes | bytearray`, found `Any | Column[str]`
+ optuna/storages/_rdb/storage.py:382:48 error[invalid-argument-type] Argument to function `loads` is incorrect: Expected `str | bytes | bytearray`, found `Any | Column[Unknown]`
- optuna/storages/_rdb/storage.py:384:16 error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `dict[Any | Column[str], Any]`
+ optuna/storages/_rdb/storage.py:384:16 error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `dict[Any | Column[Unknown], Any]`
- optuna/storages/_rdb/storage.py:391:50 error[invalid-argument-type] Argument to function `loads` is incorrect: Expected `str | bytes | bytearray`, found `Any | Column[str]`
+ optuna/storages/_rdb/storage.py:391:50 error[invalid-argument-type] Argument to function `loads` is incorrect: Expected `str | bytes | bytearray`, found `Any | Column[Unknown]`
- optuna/storages/_rdb/storage.py:393:16 error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `dict[Any | Column[str], Any]`
+ optuna/storages/_rdb/storage.py:393:16 error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `dict[Any | Column[Unknown], Any]`
- optuna/storages/_rdb/storage.py:401:48 error[invalid-argument-type] Argument to function `loads` is incorrect: Expected `str | bytes | bytearray`, found `Any | Column[str]`
+ optuna/storages/_rdb/storage.py:401:48 error[invalid-argument-type] Argument to function `loads` is incorrect: Expected `str | bytes | bytearray`, found `Any | Column[Unknown]`
- optuna/storages/_rdb/storage.py:403:16 error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `dict[Any | Column[str], Any]`
+ optuna/storages/_rdb/storage.py:403:16 error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `dict[Any | Column[Unknown], Any]`
- optuna/storages/_rdb/storage.py:411:50 error[invalid-argument-type] Argument to function `loads` is incorrect: Expected `str | bytes | bytearray`, found `Any | Column[str]`
+ optuna/storages/_rdb/storage.py:411:50 error[invalid-argument-type] Argument to function `loads` is incorrect: Expected `str | bytes | bytearray`, found `Any | Column[Unknown]`
- optuna/storages/_rdb/storage.py:413:16 error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `dict[Any | Column[str], Any]`
+ optuna/storages/_rdb/storage.py:413:16 error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `dict[Any | Column[Unknown], Any]`
- optuna/storages/_rdb/storage.py:645:21 error[invalid-argument-type] Argument to function `json_to_distribution` is incorrect: Expected `str`, found `Any | Column[str]`
+ optuna/storages/_rdb/storage.py:645:21 error[invalid-argument-type] Argument to function `json_to_distribution` is incorrect: Expected `str`, found `Any | Column[Unknown]`
- optuna/storages/_rdb/storage.py:668:16 error[invalid-return-type] Return type does not match returned value: expected `float`, found `Any | Column[float]`
+ optuna/storages/_rdb/storage.py:668:16 error[invalid-return-type] Return type does not match returned value: expected `float`, found `Any | Column[Unknown]`
- optuna/storages/_rdb/storage.py:716:13 error[invalid-assignment] Invalid assignment to data descriptor attribute `value` on type `TrialValueModel`: Argument type `MappedColumn[Any] | Column[float]` does not satisfy upper bound `Mapped[Any]` of type variable `Self`
+ optuna/storages/_rdb/storage.py:716:13 error[invalid-assignment] Invalid assignment to data descriptor attribute `value` on type `TrialValueModel`: Argument type `MappedColumn[Any] | Column[Unknown]` does not satisfy upper bound `Mapped[Any]` of type variable `Self`
- optuna/storages/_rdb/storage.py:755:13 error[invalid-assignment] Invalid assignment to data descriptor attribute `intermediate_value` on type `TrialIntermediateValueModel`: Argument type `MappedColumn[Any] | Column[float]` does not satisfy upper bound `Mapped[Any]` of type variable `Self`
+ optuna/storages/_rdb/storage.py:755:13 error[invalid-assignment] Invalid assignment to data descriptor attribute `intermediate_value` on type `TrialIntermediateValueModel`: Argument type `MappedColumn[Any] | Column[Unknown]` does not satisfy upper bound `Mapped[Any]` of type variable `Self`
- optuna/storages/_rdb/storage.py:1211:13 error[invalid-assignment] Invalid assignment to data descriptor attribute `library_version` on type `VersionInfoModel`: Argument type `MappedColumn[Any] | Column[str]` does not satisfy upper bound `Mapped[Any]` of type variable `Self`
+ optuna/storages/_rdb/storage.py:1211:13 error[invalid-assignment] Invalid assignment to data descriptor attribute `library_version` on type `VersionInfoModel`: Argument type `MappedColumn[Any] | Column[Unknown]` does not satisfy upper bound `Mapped[Any]` of type variable `Self`
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ tests/test_pandas.py:525:11 error[type-assertion-failure] Type `ndarray[tuple[int], dtype[numpy.bool[builtins.bool]]]` does not match asserted type `ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]]`
+ tests/test_pandas.py:526:11 error[type-assertion-failure] Type `ndarray[tuple[int], dtype[numpy.bool[builtins.bool]]]` does not match asserted type `ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]]`
prefect (https://github.com/PrefectHQ/prefect)
- src/integrations/prefect-redis/tests/test_tasks.py:52:12 warning[unsound-return-statement] Unsound return statement: `Unknown` is not a subtype of `str`
+ src/prefect/_internal/states.py:239:16 error[invalid-return-type] Return type does not match returned value: expected `State[R@return_value_to_state_sync]`, found `R@return_value_to_state_sync & Top[State[Unknown]]`
+ src/prefect/futures.py:252:13 error[invalid-assignment] Object of type `R@PrefectConcurrentFuture & Top[State[Unknown]]` is not assignable to attribute `_final_state` of type `State[R@PrefectConcurrentFuture] | None`
+ src/prefect/futures.py:270:17 error[invalid-assignment] Object of type `R@PrefectConcurrentFuture & Top[State[Unknown]]` is not assignable to attribute `_final_state` of type `State[R@PrefectConcurrentFuture] | None`
- src/prefect/futures.py:277:19 error[no-matching-overload] No overload of bound method `State.result` matches arguments
+ src/prefect/futures.py:277:19 error[unresolved-attribute] Attribute `result` is not defined on `None` in union `State[R@PrefectConcurrentFuture] | None`
+ src/prefect/input/run_input.py:890:16 error[invalid-return-type] Return type does not match returned value: expected `GetAutomaticInputHandler[T@receive_input] | GetInputHandler[R@receive_input]`, found `Top[GetAutomaticInputHandler[Unknown]]`
+ src/prefect/server/database/query_components.py:577:13 warning[unsound-return-statement] Unsound return statement: `Select[tuple[Unknown, datetime]]` is not a subtype of `Select[tuple[datetime, datetime]]`
+ src/prefect/states.py:369:16 error[invalid-return-type] Return type does not match returned value: expected `State[R@return_value_to_state]`, found `R@return_value_to_state & Top[State[Unknown]]`
+ src/prefect/task_engine.py:628:34 error[invalid-argument-type] Argument to bound method `SyncTaskRunEngine.handle_retry` is incorrect: Expected `Exception | State[R@SyncTaskRunEngine]`, found `R@SyncTaskRunEngine & Top[State[Unknown]]`
+ src/prefect/task_engine.py:1253:40 error[invalid-argument-type] Argument to bound method `AsyncTaskRunEngine.handle_retry` is incorrect: Expected `Exception | State[R@AsyncTaskRunEngine]`, found `R@AsyncTaskRunEngine & Top[State[Unknown]]`
scrapy (https://github.com/scrapy/scrapy)
+ scrapy/utils/defer.py:392:16 error[invalid-return-type] Return type does not match returned value: expected `Deferred[_T@deferred_from_coro] | _T2@deferred_from_coro`, found `(Awaitable[_T@deferred_from_coro] & Top[Deferred[Unknown]]) | (_T2@deferred_from_coro & Top[Deferred[Unknown]])`
+ scrapy/utils/defer.py:571:41 error[invalid-argument-type] Argument to function `maybe_deferred_to_future` is incorrect: Expected `Deferred[_T@ensure_awaitable]`, found `(_T@ensure_awaitable & Top[Deferred[Unknown]]) | (Awaitable[_T@ensure_awaitable] & Top[Deferred[Unknown]])`
streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/runtime/caching/cache_data_api.py:831:20 warning[unsound-return-statement] Unsound return statement: `Any & Top[CachedResult[Unknown]]` is not a subtype of `CachedResult[R@DataCache]`
tornado (https://github.com/tornadoweb/tornado)
+ tornado/concurrent.py:170:9 error[no-matching-overload] No overload of function `future_add_done_callback` matches arguments
Merging this PR will degrade performance by 23.38%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | ty_micro[invariant_generic_return_union] |
198.5 ms | 259.1 ms | -23.38% |
Tip
Investigate this regression with the CodSpeed MCP and your agent.
Comparing codex/invariant-typevar-materializations (a48e5bd) with main (1776127)
Footnotes
-
84 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
Validate possible overlap against TypeVar bounds and constraints, while retaining incompatible union alternatives so inference can still report argument errors. Add coverage for bounded and constrained nested type variables. Compare fixed ParamSpecs directly with materialization endpoints and clarify the parameter kind distinction between top and bottom.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes ty#4201.
ty could ignore an unresolved type variable (
T) when comparing types such aslist[T]. For example, it consideredTop[list[Unknown]]—which includes lists of every element type—a subtype oflist[T], even thoughTcould beint.This removes that shortcut, so union simplification and narrowing preserve all possible alternatives. Related overlap checks and callable-parameter (
ParamSpec) comparisons are adjusted to work without it.The extra check discussed in this review comment is now unnecessary and is removed.
Follow-up to Preserve invariant materialization constraints.