Repository navigation
Conversation
Contributor
|
@kinto0 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D125249508. |
This comment has been minimized.
This comment has been minimized.
Summary: Adds a test that shows the current behavior: when a method's decorator returns `T | Any`, the method isn't bound to the instance, so its first argument gets passed as `self`. This is the bug in facebook#5233. The next diff fixes it. Differential Revision: D125250508
kinto0
force-pushed
the
export-D125249508
branch
from
October 14, 2026 17:53
c128dc5 to
d24fade
Compare
kinto0
added a commit
to kinto0/pyrefly
that referenced
this pull request
Oct 14, 2026
Summary: Fixes facebook#5233 `make_bound_method_helper` gave up on binding a union as soon as one member could not be bound. `Any` can never be bound, so in `function | Any` the function member was left unbound, and its first argument got passed as `self`. Binding `Any` just gives `Any`, so now `Any` members pass through and the other members are still bound. Differential Revision: D125249508
kinto0
added a commit
to kinto0/pyrefly
that referenced
this pull request
Oct 14, 2026
Summary: Fixes facebook#5233 `make_bound_method_helper` gave up on binding a union as soon as one member could not be bound. `Any` can never be bound, so in `function | Any` the function member was left unbound, and its first argument got passed as `self`. Binding `Any` just gives `Any`, so now `Any` members pass through and the other members are still bound. Differential Revision: D125249508
kinto0
force-pushed
the
export-D125249508
branch
from
October 14, 2026 17:55
d24fade to
3834c24
Compare
kinto0
added a commit
to kinto0/pyrefly
that referenced
this pull request
Oct 14, 2026
Summary: Pull Request resolved: facebook#5234 Fixes facebook#5233 `make_bound_method_helper` gave up on binding a union as soon as one member could not be bound. `Any` can never be bound, so in `function | Any` the function member was left unbound, and its first argument got passed as `self`. Binding `Any` just gives `Any`, so now `Any` members pass through and the other members are still bound. Differential Revision: D125249508
kinto0
force-pushed
the
export-D125249508
branch
from
October 14, 2026 17:57
3834c24 to
bd60a00
Compare
Summary: Pull Request resolved: facebook#5234 Fixes facebook#5233 `make_bound_method_helper` gave up on binding a union as soon as one member could not be bound. `Any` can never be bound, so in `function | Any` the function member was left unbound, and its first argument got passed as `self`. Binding `Any` just gives `Any`, so now `Any` members pass through and the other members are still bound. Differential Revision: D125249508
kinto0
force-pushed
the
export-D125249508
branch
from
October 14, 2026 18:02
bd60a00 to
aaa59a2
Compare
stroxler
approved these changes
Oct 14, 2026
stroxler
left a comment
Contributor
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
|
Diff from mypy_primer, showing the effect of this PR on open source code: ============================================================
SUMMARY
============================================================
Total: +0 new errors, -82 fixed errors
By preset: +0/-82 (default), +0/-82 (strict)
Projects with changes (3):
freqtrade: +0 -2
core: +0 -70
optuna: +0 -10
============================================================
FULL DIFF DETAILS
------------------------------------------------------------
freqtrade (https://github.com/freqtrade/freqtrade)
- ERROR freqtrade/rpc/rpc.py:429:63-85: Argument `Literal['close_profit_abs']` is not assignable to parameter `self` with type `Row[float | None]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR freqtrade/rpc/rpc.py:429:63-85: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
core (https://github.com/home-assistant/core)
- ERROR homeassistant/components/recorder/auto_repairs/statistics/duplicates.py:100:21-36: Argument `Literal['start']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/auto_repairs/statistics/duplicates.py:100:21-36: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/auto_repairs/statistics/duplicates.py:100:55-76: Argument `Literal['metadata_id']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/auto_repairs/statistics/duplicates.py:100:55-76: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/auto_repairs/statistics/duplicates.py:102:21-36: Argument `Literal['start']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/auto_repairs/statistics/duplicates.py:102:21-36: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/auto_repairs/statistics/duplicates.py:103:27-48: Argument `Literal['metadata_id']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/auto_repairs/statistics/duplicates.py:103:27-48: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/auto_repairs/statistics/duplicates.py:106:30-42: Argument `Literal['id']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/auto_repairs/statistics/duplicates.py:106:30-42: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/auto_repairs/statistics/duplicates.py:216:28-50: Argument `Literal['statistic_id']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/auto_repairs/statistics/duplicates.py:216:28-50: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/auto_repairs/statistics/duplicates.py:217:28-50: Argument `Literal['statistic_id']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/auto_repairs/statistics/duplicates.py:217:28-50: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/auto_repairs/statistics/duplicates.py:219:30-42: Argument `Literal['id']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/auto_repairs/statistics/duplicates.py:219:30-42: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/migration.py:1448:44-60: Argument `Literal['id']` is not assignable to parameter `self` with type `Row[int]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/migration.py:1448:44-60: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/migration.py:1455:41-57: Argument `Literal['id']` is not assignable to parameter `self` with type `Row[int]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/migration.py:1455:41-57: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/migration.py:1456:35-55: Argument `Literal['start']` is not assignable to parameter `self` with type `Row[datetime | None, datetime | None, float | None, float | None]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/migration.py:1456:35-55: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/migration.py:1457:40-65: Argument `Literal['last_reset']` is not assignable to parameter `self` with type `Row[datetime | None, datetime | None, float | None, float | None]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/migration.py:1457:40-65: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/migration.py:1458:35-55: Argument `Literal['state']` is not assignable to parameter `self` with type `Row[datetime | None, datetime | None, float | None, float | None]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/migration.py:1458:35-55: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/migration.py:1459:33-51: Argument `Literal['sum']` is not assignable to parameter `self` with type `Row[datetime | None, datetime | None, float | None, float | None]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/migration.py:1459:33-51: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/statistics.py:1535:39-51: Argument `Literal['max']` is not assignable to parameter `self` with type `Row[Any]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/statistics.py:1535:39-51: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/statistics.py:1543:20-32: Argument `Literal['avg']` is not assignable to parameter `self` with type `Row[Any]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/statistics.py:1543:20-32: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/statistics.py:1549:42-55: Argument `Literal['mean']` is not assignable to parameter `self` with type `Row[Any]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/statistics.py:1549:42-55: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/statistics.py:1550:31-51: Argument `Literal['mean_weight']` is not assignable to parameter `self` with type `Row[Any]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/statistics.py:1550:31-51: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/statistics.py:1553:39-51: Argument `Literal['min']` is not assignable to parameter `self` with type `Row[Any]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/statistics.py:1553:39-51: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/statistics.py:1646:43-60: Argument `Literal['start_ts']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/statistics.py:1646:43-60: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/statistics.py:1665:43-60: Argument `Literal['start_ts']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/statistics.py:1665:43-60: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/statistics.py:1708:16-28: Argument `Literal['sum']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/statistics.py:1708:16-28: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/statistics.py:1802:16-28: Argument `Literal['sum']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/statistics.py:1802:16-28: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/statistics.py:2056:40-55: Argument `Literal['metadata_id']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/statistics.py:2056:40-55: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/statistics.py:2070:51-58: Argument `Literal['sum']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/statistics.py:2070:51-58: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/statistics.py:2072:43-50: Argument `Literal['sum']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/statistics.py:2072:43-50: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/statistics.py:2763:12-21: Argument `Literal['id']` is not assignable to parameter `self` with type `Row[int]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/statistics.py:2763:12-21: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/statistics.py:2960:20-32: Argument `Literal['id']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/statistics.py:2960:20-32: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/statistics.py:3069:49-55: Argument `Literal['id']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/statistics.py:3069:49-55: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/statistics.py:3071:37-45: Argument `Literal['mean']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/statistics.py:3071:37-45: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/statistics.py:3072:36-43: Argument `Literal['min']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/statistics.py:3072:36-43: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/statistics.py:3073:36-43: Argument `Literal['max']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/statistics.py:3073:36-43: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/statistics.py:3074:38-47: Argument `Literal['state']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/statistics.py:3074:38-47: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/statistics.py:3075:36-43: Argument `Literal['sum']` is not assignable to parameter `self` with type `Row[*tuple[Unknown, ...]]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/statistics.py:3075:36-43: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR homeassistant/components/recorder/table_managers/states.py:105:18-43: Argument `Literal['last_updated_ts']` is not assignable to parameter `self` with type `Row[Any]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR homeassistant/components/recorder/table_managers/states.py:105:18-43: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
optuna (https://github.com/optuna/optuna)
- ERROR optuna/storages/_rdb/storage.py:440:42-56: Argument `Literal['study_id']` is not assignable to parameter `self` with type `Row[int, str]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR optuna/storages/_rdb/storage.py:440:42-56: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR optuna/storages/_rdb/storage.py:441:46-60: Argument `Literal['study_id']` is not assignable to parameter `self` with type `Row[int, str]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR optuna/storages/_rdb/storage.py:441:46-60: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR optuna/storages/_rdb/storage.py:442:50-64: Argument `Literal['study_id']` is not assignable to parameter `self` with type `Row[int, str]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR optuna/storages/_rdb/storage.py:442:50-64: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR optuna/storages/_rdb/storage.py:445:36-52: Argument `Literal['study_name']` is not assignable to parameter `self` with type `Row[int, str]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR optuna/storages/_rdb/storage.py:445:36-52: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument]
- ERROR optuna/storages/_rdb/storage.py:450:34-48: Argument `Literal['study_id']` is not assignable to parameter `self` with type `Row[int, str]` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [bad-argument-type]
- ERROR optuna/storages/_rdb/storage.py:450:34-48: Missing argument `name` in function `sqlalchemy.engine._row_cy.BaseRow.__getattribute__` [missing-argument] |
Contributor
|
This pull request has been merged in 98fc9f2. |
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 #5233
make_bound_method_helpergave up on binding a union as soon as one member could not be bound.Anycan never be bound, so infunction | Anythe function member was left unbound, and its first argument got passed asself. BindingAnyjust givesAny, so nowAnymembers pass through and the other members are still bound.Differential Revision: D125249508