[pull] main from facebook:main#1011
Merged
Merged
Conversation
…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
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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 : )