Repository navigation
fix Lambda parameter becomes Unknown after an or when the lambda is passed to an overloaded function (sorted / list.sort key) #5396 - #5412
Closed
asukaminato0721 wants to merge 2 commits into
Closed
asukaminato0721 wants to merge 2 commits into
asukaminato0721 wants to merge 2 commits into
Conversation
Contributor
|
This pull request has been imported. If you are a Meta employee, you can view this in D127803762. (Because this pull request was imported automatically, there will not be any future comments.) |
|
Diff from mypy_primer, showing the effect of this PR on open source code: ============================================================
SUMMARY
============================================================
Total: +8 new errors, -117 fixed errors
By preset: +0/-6 (default), +0/-6 (strict)
Projects with changes (20):
rotki: +0 -4
jax: +0 -3
prefect: +0 -1
spark: +1 -7
schemathesis: +0 -9
aiortc: +0 -1
streamlit: +0 -1
dulwich: +0 -6
strawberry: +0 -5
pandera: +2 -0
steam.py: +1 -10
ibis: +0 -2
mypy: +0 -5
pandas: +0 -4
pytensor: +1 -1
meson: +0 -3
core: +3 -32
xarray: +0 -1
poetry: +0 -6
discord.py: +0 -16
============================================================
FULL DIFF DETAILS
------------------------------------------------------------
rotki (https://github.com/rotki/rotki)
- ERROR rotkehlchen/chain/evm/names.py:157:43-56: The type of this argument is unknown [unknown-argument-type]
- ERROR rotkehlchen/chain/evm/names.py:157:50-56: The type of attribute `source` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR rotkehlchen/history/manager.py:301:36-53: The type of this argument is unknown [unknown-argument-type]
- ERROR rotkehlchen/history/manager.py:301:38-51: The type of attribute `get_timestamp` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
jax (https://github.com/google/jax)
- ERROR jax/_src/api.py:1696:21-79: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR jax/_src/custom_derivatives.py:67:36-37: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR jax/_src/pallas/mosaic/pipeline.py:1325:32-33: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
prefect (https://github.com/PrefectHQ/prefect)
- ERROR src/prefect/cli/concurrency_limit.py:157:58-65: The type of attribute `created` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
spark (https://github.com/apache/spark)
- ERROR python/pyspark/pandas/tests/computation/test_apply_func.py:226:40-45: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
+ ERROR python/pyspark/pandas/tests/computation/test_apply_func.py:226:35-90: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR python/pyspark/sql/conversion.py:2177:38-48: Cannot index into `NAType` [bad-index]
- ERROR python/pyspark/sql/conversion.py:2177:50-63: Cannot index into `NAType` [bad-index]
- ERROR python/pyspark/sql/conversion.py:2182:45-53: Cannot index into `NAType` [bad-index]
- ERROR python/pyspark/sql/conversion.py:2182:55-64: Cannot index into `NAType` [bad-index]
- ERROR python/pyspark/sql/conversion.py:2187:44-52: Cannot index into `NAType` [bad-index]
- ERROR python/pyspark/sql/conversion.py:2187:54-63: Cannot index into `NAType` [bad-index]
schemathesis (https://github.com/schemathesis/schemathesis)
- ERROR src/schemathesis/cli/output.py:499:36-119: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR src/schemathesis/cli/output.py:499:50-119: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR src/schemathesis/cli/output.py:499:53-58: The type of attribute `phase` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR src/schemathesis/cli/output.py:499:59-64: The type of attribute `value` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR src/schemathesis/cli/output.py:499:99-104: The type of attribute `label` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR src/schemathesis/cli/output.py:499:108-112: The type of attribute `info` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR src/schemathesis/cli/output.py:499:113-118: The type of attribute `title` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR src/schemathesis/reporting/html/render.py:982:18-109: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR src/schemathesis/reporting/html/render.py:982:37-109: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
aiortc (https://github.com/aiortc/aiortc)
- ERROR src/aiortc/rtcpeerconnection.py:722:47-54: The type of attribute `stopped` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
streamlit (https://github.com/streamlit/streamlit)
- ERROR lib/streamlit/dataframe_util.py:1342:30-31: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
dulwich (https://github.com/dulwich/dulwich)
- ERROR dulwich/bundle_uri.py:411:13-82: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR dulwich/bundle_uri.py:411:27-82: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR dulwich/bundle_uri.py:411:29-43: The type of attribute `creation_token` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR dulwich/bundle_uri.py:462:13-88: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR dulwich/bundle_uri.py:462:27-88: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR dulwich/bundle_uri.py:462:32-46: The type of attribute `creation_token` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
strawberry (https://github.com/strawberry-graphql/strawberry)
- ERROR strawberry/annotation.py:302:17-304:18: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR strawberry/annotation.py:303:21-86: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR strawberry/schema_codegen/__init__.py:973:44-85: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR strawberry/schema_codegen/__init__.py:973:58-85: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR strawberry/schema_codegen/__init__.py:973:77-84: The type of attribute `imports` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
pandera (https://github.com/pandera-dev/pandera)
+ ERROR pandera/backends/pandas/array.py:443:45-77: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
+ ERROR pandera/backends/pandas/array.py:443:75-76: The type of this argument is unknown [unknown-argument-type]
steam.py (https://github.com/Gobot1234/steam.py)
- ERROR steam/ext/commands/converters.py:255:29-257:30: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR steam/ext/commands/converters.py:256:33-120: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR steam/ext/commands/converters.py:256:63-68: The type of attribute `inner` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR steam/ext/commands/converters.py:256:89-97: The type of attribute `position` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR steam/state.py:595:13-601:14: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR steam/state.py:596:17-600:41: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR steam/state.py:597:29-39: The type of attribute `created_at` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR steam/state.py:598:29-36: The type of attribute `ordinal` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR steam/state.py:599:29-34: The type of attribute `group` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR steam/state.py:600:29-33: The type of attribute `clan` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
+ ERROR steam/state.py:1576:29-36: The type of attribute `channel` is partially unknown; it contains an implicit `Any` [partially-unknown-type]
ibis (https://github.com/ibis-project/ibis)
- ERROR ibis/backends/postgres/tests/test_json.py:47:30-31: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR ibis/backends/tests/test_json.py:41:30-31: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
mypy (https://github.com/python/mypy)
- ERROR mypy/stubutil.py:547:13-93: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR mypy/stubutil.py:547:27-93: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR mypyc/ir/class_ir.py:496:33-78: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR mypyc/ir/class_ir.py:496:47-78: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR mypyc/ir/class_ir.py:496:73-77: The type of attribute `name` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
pandas (https://github.com/pandas-dev/pandas)
- ERROR pandas/core/reshape/merge.py:1595:59-60: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR pandas/core/reshape/merge.py:1596:59-60: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR pandas/tests/frame/test_stack_unstack.py:876:34-35: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR pandas/tests/frame/test_stack_unstack.py:940:34-35: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
pytensor (https://github.com/pymc-devs/pytensor)
- ERROR pytensor/tensor/rewriting/linalg/reassociate_matmul.py:65:72-77: The type of this argument is unknown [unknown-argument-type]
+ ERROR pytensor/tensor/rewriting/linalg/reassociate_matmul.py:65:72-77: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
meson (https://github.com/mesonbuild/meson)
- ERROR mesonbuild/interpreter/interpreter.py:1317:37-41: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR mesonbuild/modules/cmake.py:382:96-97: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR mesonbuild/modules/cmake.py:383:37-41: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
core (https://github.com/home-assistant/core)
- ERROR homeassistant/components/data_grand_lyon/config_flow.py:215:30-79: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR homeassistant/components/data_grand_lyon/config_flow.py:215:44-79: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR homeassistant/components/data_grand_lyon/config_flow.py:215:71-73: The type of attribute `id` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR homeassistant/components/data_grand_lyon/config_flow.py:349:17-71: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR homeassistant/components/data_grand_lyon/config_flow.py:349:31-71: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR homeassistant/components/data_grand_lyon/config_flow.py:349:59-65: The type of attribute `number` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR homeassistant/components/freebox/binary_sensor.py:135:22-141:10: The type of `cover_node` is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR homeassistant/components/freebox/binary_sensor.py:136:13-139:14: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR homeassistant/components/freebox/binary_sensor.py:137:17-88: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR homeassistant/components/freebox/binary_sensor.py:137:27-88: The return type of this lambda is unknown; it is inferred as an implicit `Any` [unknown-return-type]
+ ERROR homeassistant/components/freebox/binary_sensor.py:137:27-88: The return type of this lambda is an explicit `Any` [explicit-any-use]
- ERROR homeassistant/components/freebox/binary_sensor.py:142:40-50: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR homeassistant/components/knx/config_flow.py:264:21-268:22: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR homeassistant/components/knx/config_flow.py:265:25-267:31: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR homeassistant/components/knx/config_flow.py:265:32-50: The type of attribute `individual_address` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR homeassistant/components/knx/config_flow.py:265:51-54: The type of attribute `raw` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR homeassistant/components/nederlandse_spoorwegen/coordinator.py:181:13-187:14: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR homeassistant/components/nederlandse_spoorwegen/coordinator.py:182:17-186:40: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR homeassistant/components/nederlandse_spoorwegen/coordinator.py:182:22-43: The type of attribute `departure_time_actual` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR homeassistant/components/nederlandse_spoorwegen/coordinator.py:184:27-49: The type of attribute `departure_time_planned` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR homeassistant/components/nederlandse_spoorwegen/coordinator.py:185:25-47: The type of attribute `departure_time_planned` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR homeassistant/components/rejseplanen/coordinator.py:135:13-138:14: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR homeassistant/components/rejseplanen/coordinator.py:135:27-138:14: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR homeassistant/components/rejseplanen/coordinator.py:136:31-35: The type of attribute `date` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR homeassistant/components/rejseplanen/coordinator.py:137:19-25: The type of attribute `rtTime` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR homeassistant/components/rejseplanen/coordinator.py:137:31-35: The type of attribute `time` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR homeassistant/components/stream/worker.py:697:62-65: The type of this argument is unknown [unknown-argument-type]
+ ERROR homeassistant/components/stream/worker.py:697:62-65: The type of this argument is unknown because it comes from an error [unknown-from-error]
- ERROR homeassistant/components/victron_remote_monitoring/config_flow.py:130:45-79: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR homeassistant/components/victron_remote_monitoring/config_flow.py:130:59-79: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR homeassistant/components/victron_remote_monitoring/config_flow.py:130:76-78: The type of attribute `id` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR homeassistant/helpers/floor_registry.py:109:21-112:22: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR homeassistant/helpers/floor_registry.py:109:39-112:22: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR homeassistant/helpers/floor_registry.py:111:39-47: The type of attribute `casefold` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
+ ERROR homeassistant/helpers/floor_registry.py:111:39-47: The type of attribute `casefold` is an explicit `Any` [explicit-any-use]
xarray (https://github.com/pydata/xarray)
- ERROR xarray/core/options.py:150:21-26: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
poetry (https://github.com/python-poetry/poetry)
- ERROR src/poetry/packages/locker.py:498:13-506:14: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR src/poetry/packages/locker.py:498:27-506:14: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR src/poetry/packages/locker.py:502:19-29: The type of attribute `source_url` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR src/poetry/packages/locker.py:503:19-38: The type of attribute `source_subdirectory` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR src/poetry/packages/locker.py:504:19-35: The type of attribute `source_reference` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR src/poetry/packages/locker.py:505:19-44: The type of attribute `source_resolved_reference` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
discord.py (https://github.com/Rapptz/discord.py)
- ERROR discord/abc.py:824:36-94: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR discord/abc.py:824:47-94: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR discord/abc.py:824:82-84: The type of attribute `id` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR discord/guild.py:1283:31-96: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR discord/guild.py:1283:41-96: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR discord/guild.py:1283:66-79: The type of attribute `discriminator` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR discord/message.py:575:17-584:18: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR discord/message.py:576:21-583:46: The return type of this lambda is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR discord/message.py:577:27-36: The type of attribute `edited_at` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR discord/message.py:578:27-34: The type of attribute `content` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR discord/message.py:579:27-33: The type of attribute `embeds` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR discord/message.py:580:27-37: The type of attribute `components` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR discord/message.py:581:27-35: The type of attribute `stickers` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR discord/message.py:582:27-38: The type of attribute `attachments` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR discord/message.py:583:27-32: The type of attribute `flags` is unknown; it is inferred as an implicit `Any` [unknown-attribute-access]
- ERROR discord/ui/view.py:1001:66-67: The type of this argument is unknown [unknown-argument-type] |
stroxler
approved these changes
Oct 31, 2026
stroxler
left a comment
Contributor
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
meta-codesync Bot
pushed a commit
that referenced
this pull request
Oct 31, 2026
…assed to an overloaded function (sorted / list.sort key) #5396 Summary: Fixes #5396 The fix extends the existing lambda parameter cache bypass. It follows Forward, Narrow, and Phi(NarrowOf) bindings to their source. If the source is a lambda parameter, it recomputes the result from the current contextual type. - [x] I am a human, and I fully understand the code I am submitting. X-link: #5412 Reviewed By: stroxler Differential Revision: D127803762 fbshipit-source-id: a06b868bc625a72fe7fa64e8375ba4160d174d3f
|
Closing this PR because linked issue #5396 was closed. |
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.
Summary
Fixes #5396
The fix extends the existing lambda parameter cache bypass.
It follows Forward, Narrow, and Phi(NarrowOf) bindings to their source.
If the source is a lambda parameter, it recomputes the result from the current contextual type.
Test Plan
add test