Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use namespaces for function type variables #17311

Merged
merged 9 commits into from
Jun 5, 2024

Conversation

ilevkivskyi
Copy link
Member

@ilevkivskyi ilevkivskyi commented Jun 1, 2024

Fixes #16582

IMO this is long overdue. Currently, type variable IDs are 99% unique, but when they accidentally clash, it causes hard to debug issues. The implementation is generally straightforward, but it uncovered a whole bunch of unrelated bugs. Few notes:

  • This still doesn't fix the type variables in nested generic callable types (those that appear in return types of another generic callable). It is non-trivial to put namespace there, and luckily this situation is already special-cased in checkexpr.py to avoid ID clashes.
  • This uncovered a bug in overloaded dunder overrides handling, fix is simple.
  • This also uncovered a deeper problem in unsafe overload overlap logic (w.r.t. partial parameters overlap). Here proper fix would be hard, so instead I tweak current logic so it will not cause false positives, at a cost of possible false negatives.
  • This makes explicit that we use a somewhat ad-hoc logic for join/meet of generic callables. FWIW I decided to keep it, since it seems to work reasonably well.
  • This accidentally highlighted two bugs in error message locations. One very old one related to type aliases, I fixed newly discovered cases by extending a previous partial fix. Second, the error locations generated by partial plugin were completely off (you can see examples in mypy_primer where there were errors on empty lines etc).
  • This PR (naturally) causes a significant amount of new valid errors (fixed false negatives). To improve the error messages, I extend the name disambiguation logic to include type variables (and also type aliases, while I am at it), previously it only applied to Instances. Note that I use a notation TypeVar@namespace, which is a semantic equivalent of qualified name for type variables. For now, I shorten the namespace to only the last component, to make errors less verbose. We can reconsider this if it causes confusion.
  • Finally, this PR will hopefully allow a more principled implementation of Use new type inference as a primary mechanism #15907

This comment has been minimized.

@ilevkivskyi
Copy link
Member Author

I briefly looked at mypy_primer, at least some of the errors are real (people forget Generic[T] in class definitions). I will more carefully go through all of them later. But it is clear that I should update the error reporting logic to include namespace when type variable names are the same.

Copy link
Contributor

@stroxler stroxler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty reasonable to me although I'm new to MyPy.

It's an interesting read, we have (bigger) type variable identification issues in Pyre and seeing MyPy's logic + improvements to it is helpful!


def add_method(
funcname: str,
ret: Type,
ret: Type | None, # None means use (patched) self-type
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize we can't pass self_type anymore because the ids are now per method. Would it make sense to create a no-op class for this

class SelfTypeMarker:
    pass

so that the type here would be

ret: Type | SelfTypeMarker

?

Given the comment here I don't think it makes that much difference to understandability of the implementation, but lifting the semantics to the type level probably makes callsites easier to read and will make things like signature help in the IDE more descriptive.

@@ -620,13 +627,13 @@ def add_method(

add_method(
"_replace",
ret=selftype,
ret=None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(all the calls in this block are examples of where I think the code is less readable now, and making a dummy SelfTypeMarker class would help)

@@ -569,40 +570,46 @@ def add_field(
add_field(Var("__match_args__", match_args_type), is_initialized_in_class=True)

assert info.tuple_type is not None # Set by update_tuple_type() above.
tvd = TypeVarType(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the name "tvd" supposed to mean?

Glad to see it gone, the only thing I can even come up with is "type var default" but that doesn't seem like the best name for something that's only ever self type even in non-abbreviated form.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"tvd" stays for TypeVarDef which is not a thing since around couple years ago.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@ilevkivskyi
Copy link
Member Author

I went through the mypy_primer and all looks correct. Few clarifications (in random order):

  • All of the +/- diff is from correcting partial error locations and replacing obscure errors like expected "T" got "T" with expected "T@one" got "T@another".
  • Majority of the + diff is because people forget to put Generic[T] in class declaration, while still using T in __init__().
  • There is one case where we get expected "T" got "T" error. This is because the conflict is between variables with the same name used in __init__() of different classes. I am not sure what to do about this, but as I mention in PR description we can easily tweak this later.
  • A big bunch of new errors in Tanjun looks correct (not sure why there were not caught before). I spot-checked a few of them and they are all caused by same thing: Carelessly mixing type variables where one has e.g. an upper bound of callable with MessageContext prefix, and other has callable bound with MenuContext prefix. (A note for careful reader, we intentionally allow type variables with too high upper bounds in generic type alias definitions, for various reasons, and only give an error if the upper bound is violated in actual type annotation).

@JukkaL @hauntsaninja This is ready for review, please take a look.

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!!

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent! Bugs related to generics tend to be very confusing and hard to investigate. The clearer error messages are also nice.

Copy link
Contributor

github-actions bot commented Jun 5, 2024

Diff from mypy_primer, showing the effect of this PR on open source code:

python-chess (https://github.com/niklasf/python-chess)
+ chess/__init__.py:1780: error: Argument 1 to "restore" of "_BoardState" has incompatible type "BoardT@root"; expected "BoardT@__init__"  [arg-type]
+ chess/__init__.py:2328: error: Argument 1 to "append" of "list" has incompatible type "_BoardState[BoardT@push]"; expected "_BoardState[BoardT@__init__]"  [arg-type]
+ chess/__init__.py:2428: error: Argument 1 to "restore" of "_BoardState" has incompatible type "BoardT@pop"; expected "BoardT@__init__"  [arg-type]
+ chess/engine.py:926: error: Argument 1 to "_engine_terminated" of "BaseCommand" has incompatible type "ProtocolT@connection_lost"; expected "ProtocolT@__init__"  [arg-type]
+ chess/engine.py:929: error: Argument 1 to "_engine_terminated" of "BaseCommand" has incompatible type "ProtocolT@connection_lost"; expected "ProtocolT@__init__"  [arg-type]
+ chess/engine.py:969: error: Argument 1 to "_line_received" of "BaseCommand" has incompatible type "ProtocolT@_line_received"; expected "ProtocolT@__init__"  [arg-type]
+ chess/engine.py:987: error: Incompatible types in assignment (expression has type "BaseCommand[ProtocolT@communicate, T]", variable has type "BaseCommand[ProtocolT@__init__, Any] | None")  [assignment]
+ chess/engine.py:996: error: Argument 1 to "_cancel" of "BaseCommand" has incompatible type "ProtocolT@communicate"; expected "ProtocolT@__init__"  [arg-type]
+ chess/engine.py:1000: error: Argument 1 to "_start" of "BaseCommand" has incompatible type "ProtocolT@communicate"; expected "ProtocolT@__init__"  [arg-type]
+ chess/engine.py:1007: error: Argument 1 to "_cancel" of "BaseCommand" has incompatible type "ProtocolT@communicate"; expected "ProtocolT@__init__"  [arg-type]

pip (https://github.com/pypa/pip)
- src/pip/_internal/cli/progress_bars.py:90: error: Argument 2 to "_rich_progress_bar" has incompatible type "int | None"; expected "int"  [arg-type]
+ src/pip/_internal/cli/progress_bars.py:90: error: Argument "size" to "_rich_progress_bar" has incompatible type "int | None"; expected "int"  [arg-type]

steam.py (https://github.com/Gobot1234/steam.py)
- steam/ext/commands/commands.py:741: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [overload-overlap]
- steam/ext/commands/commands.py:851: error: Overloaded function implementation cannot satisfy signature 2 due to inconsistencies in how they use type variables  [misc]

pandas (https://github.com/pandas-dev/pandas)
- pandas/core/window/rolling.py:1496: error: Argument 3 to "roll_apply" has incompatible type "bool | bool_"; expected "bool"  [arg-type]
+ pandas/core/window/rolling.py:1496: error: Argument "raw" to "roll_apply" has incompatible type "bool | bool_"; expected "bool"  [arg-type]
- pandas/core/tools/datetimes.py:1001: error: Argument 6 to "_convert_listlike_datetimes" has incompatible type "bool | Literal[_NoDefault.no_default]"; expected "bool"  [arg-type]
+ pandas/core/tools/datetimes.py:1001: error: Argument "exact" to "_convert_listlike_datetimes" has incompatible type "bool | Literal[_NoDefault.no_default]"; expected "bool"  [arg-type]
- pandas/core/groupby/groupby.py:4374: error: Argument 3 to "group_quantile" has incompatible type "str"; expected "Literal['linear', 'lower', 'higher', 'nearest', 'midpoint']"  [arg-type]
+ pandas/core/groupby/groupby.py:4374: error: Argument "interpolation" to "group_quantile" has incompatible type "str"; expected "Literal['linear', 'lower', 'higher', 'nearest', 'midpoint']"  [arg-type]
- pandas/tests/indexes/test_base.py:148: error: Unexpected keyword argument "data" for "RangeIndex"  [call-arg]
+ pandas/tests/indexes/test_base.py:1603: error: Unexpected keyword argument "data" for "RangeIndex"  [call-arg]

starlette (https://github.com/encode/starlette)
- starlette/routing.py:36: error: Too few arguments for "run_in_threadpool"  [call-arg]

Tanjun (https://github.com/FasterSpeeding/Tanjun)
+ tanjun/commands/slash.py:373: error: Type argument "_SlashCallbackSigT" of "MenuCommand" must be a subtype of "Callable[[MenuContext, Any, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]
+ tanjun/commands/slash.py:373: error: Type argument "_SlashCallbackSigT" of "MessageCommand" must be a subtype of "Callable[[MessageContext, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]
+ tanjun/commands/slash.py:1270: error: Type argument "_SlashCallbackSigT" of "MenuCommand" must be a subtype of "Callable[[MenuContext, Any, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]
+ tanjun/commands/slash.py:1270: error: Type argument "_SlashCallbackSigT" of "MessageCommand" must be a subtype of "Callable[[MessageContext, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]
+ tanjun/commands/slash.py:1324: error: Type argument "_SlashCallbackSigT" of "MenuCommand" must be a subtype of "Callable[[MenuContext, Any, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]
+ tanjun/commands/slash.py:1324: error: Type argument "_SlashCallbackSigT" of "MessageCommand" must be a subtype of "Callable[[MessageContext, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]
+ tanjun/commands/message.py:101: error: Type argument "_MessageCallbackSigT" of "MenuCommand" must be a subtype of "Callable[[MenuContext, Any, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]
+ tanjun/commands/message.py:101: error: Type argument "_MessageCallbackSigT" of "SlashCommand" must be a subtype of "Callable[[SlashContext, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]
+ tanjun/commands/message.py:124: error: Type argument "_MessageCallbackSigT" of "MenuCommand" must be a subtype of "Callable[[MenuContext, Any, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]
+ tanjun/commands/message.py:124: error: Type argument "_MessageCallbackSigT" of "SlashCommand" must be a subtype of "Callable[[SlashContext, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]
+ tanjun/commands/message.py:483: error: Type argument "_OtherCallbackSigT" of "MenuCommand" must be a subtype of "Callable[[MenuContext, Any, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]
+ tanjun/commands/message.py:483: error: Type argument "_OtherCallbackSigT" of "SlashCommand" must be a subtype of "Callable[[SlashContext, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]
+ tanjun/commands/message.py:506: error: Type argument "_OtherCallbackSigT" of "MenuCommand" must be a subtype of "Callable[[MenuContext, Any, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]
+ tanjun/commands/message.py:506: error: Type argument "_OtherCallbackSigT" of "SlashCommand" must be a subtype of "Callable[[SlashContext, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]
+ tanjun/commands/menu.py:172: error: Type argument "_MessageCallbackSigT" of "MessageCommand" must be a subtype of "Callable[[MessageContext, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]
+ tanjun/commands/menu.py:172: error: Type argument "_MessageCallbackSigT" of "SlashCommand" must be a subtype of "Callable[[SlashContext, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]
+ tanjun/commands/menu.py:182: error: Incompatible return value type (got "MenuCommand[_MessageCallbackSigT@__init__, Literal[CommandType.MESSAGE]]", expected "MenuCommand[_MessageCallbackSigT@decorator, Literal[CommandType.MESSAGE]]")  [return-value]
+ tanjun/commands/menu.py:299: error: Type argument "_UserCallbackSigT" of "MessageCommand" must be a subtype of "Callable[[MessageContext, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]
+ tanjun/commands/menu.py:299: error: Type argument "_UserCallbackSigT" of "SlashCommand" must be a subtype of "Callable[[SlashContext, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]
+ tanjun/commands/menu.py:309: error: Incompatible return value type (got "MenuCommand[_UserCallbackSigT@__init__, Literal[CommandType.USER]]", expected "MenuCommand[_UserCallbackSigT@decorator, Literal[CommandType.USER]]")  [return-value]
+ tanjun/commands/menu.py:369: error: Type argument "_UserCallbackSigT" of "MessageCommand" must be a subtype of "Callable[[MessageContext, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]
+ tanjun/commands/menu.py:369: error: Type argument "_UserCallbackSigT" of "SlashCommand" must be a subtype of "Callable[[SlashContext, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]
+ tanjun/commands/menu.py:405: error: Type argument "_MessageCallbackSigT" of "MessageCommand" must be a subtype of "Callable[[MessageContext, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]
+ tanjun/commands/menu.py:405: error: Type argument "_MessageCallbackSigT" of "SlashCommand" must be a subtype of "Callable[[SlashContext, VarArg(Any), KwArg(Any)], Coroutine[Any, Any, None]]"  [type-var]

vision (https://github.com/pytorch/vision)
- torchvision/models/video/swin_transformer.py:518: error: Argument 2 to "VideoClassification" has incompatible type "tuple[int]"; expected "tuple[int, int]"  [arg-type]
+ torchvision/models/video/swin_transformer.py:518: error: Argument "resize_size" to "VideoClassification" has incompatible type "tuple[int]"; expected "tuple[int, int]"  [arg-type]
- torchvision/models/video/swin_transformer.py:549: error: Argument 2 to "VideoClassification" has incompatible type "tuple[int]"; expected "tuple[int, int]"  [arg-type]
+ torchvision/models/video/swin_transformer.py:549: error: Argument "resize_size" to "VideoClassification" has incompatible type "tuple[int]"; expected "tuple[int, int]"  [arg-type]
- torchvision/models/video/swin_transformer.py:580: error: Argument 2 to "VideoClassification" has incompatible type "tuple[int]"; expected "tuple[int, int]"  [arg-type]
+ torchvision/models/video/swin_transformer.py:580: error: Argument "resize_size" to "VideoClassification" has incompatible type "tuple[int]"; expected "tuple[int, int]"  [arg-type]
- torchvision/models/video/swin_transformer.py:607: error: Argument 2 to "VideoClassification" has incompatible type "tuple[int]"; expected "tuple[int, int]"  [arg-type]
+ torchvision/models/video/swin_transformer.py:607: error: Argument "resize_size" to "VideoClassification" has incompatible type "tuple[int]"; expected "tuple[int, int]"  [arg-type]
- torchvision/models/video/mvit.py:607: error: Argument 2 to "VideoClassification" has incompatible type "tuple[int]"; expected "tuple[int, int]"  [arg-type]
+ torchvision/models/video/mvit.py:607: error: Argument "resize_size" to "VideoClassification" has incompatible type "tuple[int]"; expected "tuple[int, int]"  [arg-type]
- torchvision/models/video/mvit.py:640: error: Argument 2 to "VideoClassification" has incompatible type "tuple[int]"; expected "tuple[int, int]"  [arg-type]
+ torchvision/models/video/mvit.py:640: error: Argument "resize_size" to "VideoClassification" has incompatible type "tuple[int]"; expected "tuple[int, int]"  [arg-type]

spack (https://github.com/spack/spack)
- lib/spack/spack/filesystem_view.py:133: error: Unexpected keyword argument "view"  [call-arg]
+ lib/spack/spack/filesystem_view.py:183: error: Unexpected keyword argument "view"  [call-arg]

kopf (https://github.com/nolar/kopf)
- kopf/_core/reactor/orchestration.py:42: error: Unexpected keyword argument "resource" for "__call__" of "WatchStreamProcessor"  [call-arg]
+ kopf/_core/reactor/orchestration.py:246: error: Unexpected keyword argument "resource" for "__call__" of "WatchStreamProcessor"  [call-arg]

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/encryption.py:359: error: Incompatible types in assignment (expression has type "MongoClient[_DocumentTypeArg]", variable has type "MongoClient[_DocumentTypeArg]")  [assignment]

graphql-core (https://github.com/graphql-python/graphql-core)
+ src/graphql/execution/async_iterables.py:34: error: Incompatible return value type (got "AsyncGenerator[T@__init__, None] | AsyncIterable[T@__init__]", expected "AsyncGenerator[T@__aenter__, None] | AsyncIterable[T@__aenter__]")  [return-value]

jax (https://github.com/google/jax)
+ jax/_src/tree_util.py:964: error: Invalid index type "type[T@_register_keypaths]" for "dict[type[T], _RegistryWithKeypathsEntry]"; expected type "type[T@register_pytree_with_keys]"  [index]
- jax/_src/scipy/signal.py:674: error: Argument 1 to "detrend" has incompatible type "Literal[True] | str"; expected "str"  [arg-type]
+ jax/_src/scipy/signal.py:674: error: Argument "type" to "detrend" has incompatible type "Literal[True] | str"; expected "str"  [arg-type]
- jax/experimental/pallas/ops/gpu/rms_norm.py:243: error: Argument 1 to "custom_vjp" has incompatible type "list[int]"; expected "tuple[int, ...]"  [arg-type]
+ jax/experimental/pallas/ops/gpu/rms_norm.py:243: error: Argument "nondiff_argnums" to "custom_vjp" has incompatible type "list[int]"; expected "tuple[int, ...]"  [arg-type]
- jax/experimental/pallas/ops/gpu/layer_norm.py:262: error: Argument 1 to "custom_vjp" has incompatible type "list[int]"; expected "tuple[int, ...]"  [arg-type]
+ jax/experimental/pallas/ops/gpu/layer_norm.py:262: error: Argument "nondiff_argnums" to "custom_vjp" has incompatible type "list[int]"; expected "tuple[int, ...]"  [arg-type]
- jax/experimental/pallas/ops/gpu/attention.py:149: error: Argument 1 to "custom_vjp" has incompatible type "list[int]"; expected "tuple[int, ...]"  [arg-type]
+ jax/experimental/pallas/ops/gpu/attention.py:149: error: Argument "nondiff_argnums" to "custom_vjp" has incompatible type "list[int]"; expected "tuple[int, ...]"  [arg-type]
- jax/experimental/pallas/ops/tpu/flash_attention.py:203: error: Argument 1 to "custom_vjp" has incompatible type "range"; expected "tuple[int, ...]"  [arg-type]
+ jax/experimental/pallas/ops/tpu/flash_attention.py:203: error: Argument "nondiff_argnums" to "custom_vjp" has incompatible type "range"; expected "tuple[int, ...]"  [arg-type]
- jax/experimental/pallas/ops/tpu/flash_attention.py:1088: error: Argument 1 to "_flash_attention_dkv_kernel" has incompatible type "int | None"; expected "int"  [arg-type]
+ jax/experimental/pallas/ops/tpu/flash_attention.py:1088: error: Argument "block_q" to "_flash_attention_dkv_kernel" has incompatible type "int | None"; expected "int"  [arg-type]
- jax/experimental/pallas/ops/tpu/flash_attention.py:1089: error: Argument 2 to "_flash_attention_dkv_kernel" has incompatible type "int | None"; expected "int"  [arg-type]
+ jax/experimental/pallas/ops/tpu/flash_attention.py:1089: error: Argument "block_k" to "_flash_attention_dkv_kernel" has incompatible type "int | None"; expected "int"  [arg-type]
- jax/experimental/pallas/ops/tpu/flash_attention.py:1437: error: Argument 4 to "_flash_attention_dq_kernel" has incompatible type "int | None"; expected "int"  [arg-type]
+ jax/experimental/pallas/ops/tpu/flash_attention.py:1437: error: Argument "block_k" to "_flash_attention_dq_kernel" has incompatible type "int | None"; expected "int"  [arg-type]
- jax/experimental/pallas/ops/tpu/paged_attention/paged_attention_kernel.py:618: error: Argument 5 has incompatible type "str | None"; expected "str"  [arg-type]
+ jax/experimental/pallas/ops/tpu/paged_attention/paged_attention_kernel.py:618: error: Argument "megacore_mode" has incompatible type "str | None"; expected "str"  [arg-type]

aiohttp (https://github.com/aio-libs/aiohttp)
- aiohttp/web_app.py:56:37: error: Unexpected keyword argument "handler"  [call-arg]
+ aiohttp/web_app.py:386:50: error: Unexpected keyword argument "handler"  [call-arg]
- aiohttp/web_app.py:56:37: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-call-arg for more info
+ aiohttp/web_app.py:386:50: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-call-arg for more info

scrapy (https://github.com/scrapy/scrapy)
+ scrapy/utils/defer.py:211: error: Argument 1 has incompatible type "_T@_callback"; expected "_T@__init__"  [arg-type]

discord.py (https://github.com/Rapptz/discord.py)
- discord/ext/commands/hybrid.py:836: error: Incompatible return value type (got "Callable[[Callable[[CogT, ContextT, **P2], Coroutine[Any, Any, U]] | Callable[[ContextT, **P2], Coroutine[Any, Any, U]]], Any]", expected "Callable[[Callable[[CogT, ContextT, **P2], Coroutine[Any, Any, U]] | Callable[[ContextT, **P2], Coroutine[Any, Any, U]]], HybridCommand[CogT, P2, U]]")  [return-value]
+ discord/ext/commands/hybrid.py:836: error: Incompatible return value type (got "Callable[[Callable[[CogT, ContextT@decorator, **P2], Coroutine[Any, Any, U@decorator]] | Callable[[ContextT@decorator, **P2], Coroutine[Any, Any, U@decorator]]], Any]", expected "Callable[[Callable[[CogT, ContextT, **P2], Coroutine[Any, Any, U]] | Callable[[ContextT, **P2], Coroutine[Any, Any, U]]], HybridCommand[CogT, P2, U]]")  [return-value]
- discord/ext/commands/hybrid.py:860: error: Incompatible return value type (got "Callable[[Callable[[CogT, ContextT, **P2], Coroutine[Any, Any, U]] | Callable[[ContextT, **P2], Coroutine[Any, Any, U]]], Any]", expected "Callable[[Callable[[CogT, ContextT, **P2], Coroutine[Any, Any, U]] | Callable[[ContextT, **P2], Coroutine[Any, Any, U]]], HybridGroup[CogT, P2, U]]")  [return-value]
+ discord/ext/commands/hybrid.py:860: error: Incompatible return value type (got "Callable[[Callable[[CogT, ContextT@decorator, **P2], Coroutine[Any, Any, U@decorator]] | Callable[[ContextT@decorator, **P2], Coroutine[Any, Any, U@decorator]]], Any]", expected "Callable[[Callable[[CogT, ContextT, **P2], Coroutine[Any, Any, U]] | Callable[[ContextT, **P2], Coroutine[Any, Any, U]]], HybridGroup[CogT, P2, U]]")  [return-value]
- discord/ext/commands/bot.py:301: error: Incompatible return value type (got "Callable[[Callable[[Any, ContextT, **P], Coroutine[Any, Any, T]] | Callable[[ContextT, **P], Coroutine[Any, Any, T]]], Any]", expected "Callable[[Callable[[Any, ContextT, **P], Coroutine[Any, Any, T]] | Callable[[ContextT, **P], Coroutine[Any, Any, T]]], HybridCommand[Any, P, T]]")  [return-value]
+ discord/ext/commands/bot.py:301: error: Incompatible return value type (got "Callable[[Callable[[Any, ContextT@decorator, **P], Coroutine[Any, Any, T@decorator]] | Callable[[ContextT@decorator, **P], Coroutine[Any, Any, T@decorator]]], Any]", expected "Callable[[Callable[[Any, ContextT, **P], Coroutine[Any, Any, T]] | Callable[[ContextT, **P], Coroutine[Any, Any, T]]], HybridCommand[Any, P, T]]")  [return-value]
- discord/ext/commands/bot.py:325: error: Incompatible return value type (got "Callable[[Callable[[Any, ContextT, **P], Coroutine[Any, Any, T]] | Callable[[ContextT, **P], Coroutine[Any, Any, T]]], Any]", expected "Callable[[Callable[[Any, ContextT, **P], Coroutine[Any, Any, T]] | Callable[[ContextT, **P], Coroutine[Any, Any, T]]], HybridGroup[Any, P, T]]")  [return-value]
+ discord/ext/commands/bot.py:325: error: Incompatible return value type (got "Callable[[Callable[[Any, ContextT@decorator, **P], Coroutine[Any, Any, T@decorator]] | Callable[[ContextT@decorator, **P], Coroutine[Any, Any, T@decorator]]], Any]", expected "Callable[[Callable[[Any, ContextT, **P], Coroutine[Any, Any, T]] | Callable[[ContextT, **P], Coroutine[Any, Any, T]]], HybridGroup[Any, P, T]]")  [return-value]

ibis (https://github.com/ibis-project/ibis)
- ibis/expr/operations/tests/test_generic.py:145: error: Too many arguments for "Literal"  [call-arg]
+ ibis/expr/operations/tests/test_generic.py:112: error: Too many arguments for "Literal"  [call-arg]
- ibis/expr/operations/tests/test_generic.py:145: error: Unexpected keyword argument "name" for "Literal"  [call-arg]
+ ibis/expr/operations/tests/test_generic.py:113: error: Unexpected keyword argument "name" for "Literal"  [call-arg]
- ibis/expr/operations/tests/test_generic.py:145: error: "Literal" gets multiple values for keyword argument "dtype"  [misc]
+ ibis/expr/operations/tests/test_generic.py:115: error: "Literal" gets multiple values for keyword argument "dtype"  [misc]

bokeh (https://github.com/bokeh/bokeh)
- src/bokeh/driving.py:97:36: error: Argument 1 to "force" has incompatible type "Iterable[int]"; expected "Iterator[Any]"  [arg-type]
+ src/bokeh/driving.py:97:36: error: Argument "sequence" to "force" has incompatible type "Iterable[int]"; expected "Iterator[Any]"  [arg-type]
- src/bokeh/driving.py:116:36: error: Argument 1 to "force" has incompatible type "Iterable[float]"; expected "Iterator[Any]"  [arg-type]
+ src/bokeh/driving.py:116:36: error: Argument "sequence" to "force" has incompatible type "Iterable[float]"; expected "Iterator[Any]"  [arg-type]
- src/bokeh/driving.py:122:36: error: Argument 1 to "force" has incompatible type "Iterable[int]"; expected "Iterator[Any]"  [arg-type]
+ src/bokeh/driving.py:122:36: error: Argument "sequence" to "force" has incompatible type "Iterable[int]"; expected "Iterator[Any]"  [arg-type]
- src/bokeh/driving.py:154:36: error: Argument 1 to "force" has incompatible type "Iterable[float]"; expected "Iterator[Any]"  [arg-type]
+ src/bokeh/driving.py:154:36: error: Argument "sequence" to "force" has incompatible type "Iterable[float]"; expected "Iterator[Any]"  [arg-type]
- src/bokeh/driving.py:172:36: error: Argument 1 to "force" has incompatible type "Iterable[int]"; expected "Iterator[Any]"  [arg-type]
+ src/bokeh/driving.py:172:36: error: Argument "sequence" to "force" has incompatible type "Iterable[int]"; expected "Iterator[Any]"  [arg-type]
- src/bokeh/driving.py:191:36: error: Argument 1 to "force" has incompatible type "Iterable[float]"; expected "Iterator[Any]"  [arg-type]
+ src/bokeh/driving.py:191:36: error: Argument "sequence" to "force" has incompatible type "Iterable[float]"; expected "Iterator[Any]"  [arg-type]

hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
- src/hydra_zen/wrapper/_implementations.py:58: error: Too few arguments for "run" of "Context"  [call-arg]
+ src/hydra_zen/wrapper/_implementations.py:414: error: Too few arguments for "run" of "Context"  [call-arg]
- src/hydra_zen/wrapper/_implementations.py:563: error: Overloaded function implementation cannot satisfy signature 2 due to inconsistencies in how they use type variables  [misc]
- src/hydra_zen/wrapper/_implementations.py:837: error: Argument "instantiation_wrapper" to "Zen" has incompatible type "Callable[[F2], F2] | None"; expected "Callable[[F2], F2] | None"  [arg-type]
+ src/hydra_zen/wrapper/_implementations.py:837: error: Argument "instantiation_wrapper" to "Zen" has incompatible type "Callable[[F2@zen], F2@zen] | None"; expected "Callable[[F2@__init__], F2@__init__] | None"  [arg-type]
- src/hydra_zen/wrapper/_implementations.py:851: error: Argument "instantiation_wrapper" to "Zen" has incompatible type "Callable[[F2], F2] | None"; expected "Callable[[F2], F2] | None"  [arg-type]
+ src/hydra_zen/wrapper/_implementations.py:851: error: Argument "instantiation_wrapper" to "Zen" has incompatible type "Callable[[F2@zen], F2@zen] | None"; expected "Callable[[F2@__init__], F2@__init__] | None"  [arg-type]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Constraint solver regression in mypy 1.7.1
4 participants