Skip to content

[pull] main from facebook:main#1011

Merged
pull[bot] merged 3 commits into
CrazyForks:mainfrom
facebook:main
Jul 11, 2026
Merged

[pull] main from facebook:main#1011
pull[bot] merged 3 commits into
CrazyForks:mainfrom
facebook:main

Conversation

@pull

@pull pull Bot commented Jul 11, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

jorenham and others added 3 commits July 10, 2026 14:17
…l` (#3975)

Summary:
`filter_overloads_by_self_type` dropped any overload whose `self:` mentions the overload's own type params, since `is_subset_eq(receiver, self)` checks against a rigid, unsolvable variable. Substitute those params with `Any` first, so the receiver is matched against a gradual `self:`.
An overload whose `self:` mentions its own type parameters is matched gradually by substituting those parameters with `Any (self: Arr[S, T] -> Arr[Any, Any])`, which is exact for the realistic single-occurrence case and only over-accepts the presumably niche degenerate repeated-parameter case, `(self: C[Z, Z])`, same as mypy and pyright.

Fixes #3974

Pull Request resolved: #3975

Test Plan: Regression tests added

Reviewed By: stroxler

Differential Revision: D111462642

Pulled By: NathanTempest

fbshipit-source-id: 97419e2b60e39fb737efe881909b53d3bda16573
Summary:
Pyrefly represents specialized `TypeVarTuple` arguments as tuple carriers in some class-specialization paths. That means two equivalent varargs annotations can reach callable subtyping in different internal forms: `*args: *Ts` on one side and `*args: *tuple[*Ts]` on the other. Before this diff, that representation mismatch caused Pyrefly to reject valid method overrides and callable assignments involving inherited generic `*args`.

This diff normalizes the pure tuple-carrier form when comparing two unpacked varargs, so `*Ts` and `*tuple[*Ts]` are treated as the same variadic parameter sequence. The normalization is intentionally narrow: it only applies to pure carriers with no prefix or suffix elements, preserving the existing behavior for forms like `tuple[int, *Ts]` or `tuple[*Ts, str]`.

Tests cover both the inherited-method override case and the callable varargs case that protects `tuple[*Ts]` against homogeneous tuple packs.

Fixes #4073

Reviewed By: kinto0

Differential Revision: D110970933

fbshipit-source-id: 852ca320ff076fe45b592e96511ba18c7b372366
… applied by call

Summary:
The `f.register(C)` decorator already returns the registered impl's own type, so direct calls to a decorated impl are argument-checked. But applying that decorator by an explicit call — `f.register(C)(impl)` or `deco = f.register(C); deco(impl)` — instead fell through to normal call inference over the stub's erased `register` return, yielding `(...) -> str` and dropping argument checking on the result.

Handle the explicit-call form like `@`-syntax: when the callee is the `KwCall` tagged `SingleDispatchRegister` that `f.register(C)` produces, return the applied argument's own type. The dispatch class was already validated when `f.register(C)` was inferred, so no subtype re-check is done here - which also avoids a double diagnostic on the non-subtype case.

Reviewed By: kinto0

Differential Revision: D110936024

fbshipit-source-id: 141f26947c7fff2ab15e55e22354c5da1a113e22
@pull pull Bot locked and limited conversation to collaborators Jul 11, 2026
@pull pull Bot added the ⤵️ pull label Jul 11, 2026
@pull pull Bot merged commit 3a5e377 into CrazyForks:main Jul 11, 2026
1 of 6 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants