-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Improve error message for callables with invalid Concatenate
#13529
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
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you check the primer output? It looks like there are some lines that used to error that have no errors... is that a good thing?
Yes, I am looking at it right now!
Hm 🤔 Looks like unbound
Code: Unbound I will fix it and write extra tests tomorrow 🌆 |
Diff from mypy_primer, showing the effect of this PR on open source code: discord.py (https://github.com/Rapptz/discord.py)
- discord/app_commands/commands.py:113: error: The first argument to Callable must be a list of types, parameter specification, or "..."
- discord/app_commands/commands.py:113: note: See https://mypy.readthedocs.io/en/stable/kinds_of_types.html#callable-types-and-lambdas
- discord/app_commands/commands.py:114: error: The first argument to Callable must be a list of types, parameter specification, or "..."
- discord/app_commands/commands.py:114: note: See https://mypy.readthedocs.io/en/stable/kinds_of_types.html#callable-types-and-lambdas
+ discord/app_commands/commands.py:672: error: Item "function" of "Union[Callable[[VarArg(Any), KwArg(Any)], Any], Callable[[VarArg(Any), KwArg(Any)], Any]]" has no attribute "__self__"
+ discord/app_commands/commands.py:673: error: Item "function" of "Union[Callable[[VarArg(Any), KwArg(Any)], Any], Callable[[VarArg(Any), KwArg(Any)], Any]]" has no attribute "__func__"
- discord/app_commands/commands.py:2408: error: Item "function" of "Union[Any, Callable[[Interaction, Member], Coroutine[Any, Any, Any]], Callable[[Interaction, User], Coroutine[Any, Any, Any]], Callable[[Interaction, Message], Coroutine[Any, Any, Any]]]" has no attribute "__discord_app_commands_checks__"
+ discord/app_commands/commands.py:2408: error: Item "function" of "Union[Callable[[VarArg(Any), KwArg(Any)], Any], Callable[[Interaction, Member], Coroutine[Any, Any, Any]], Callable[[Interaction, User], Coroutine[Any, Any, Any]], Callable[[Interaction, Message], Coroutine[Any, Any, Any]]]" has no attribute "__discord_app_commands_checks__"
- discord/app_commands/commands.py:2410: error: Item "function" of "Union[Any, Callable[[Interaction, Member], Coroutine[Any, Any, Any]], Callable[[Interaction, User], Coroutine[Any, Any, Any]], Callable[[Interaction, Message], Coroutine[Any, Any, Any]]]" has no attribute "__discord_app_commands_checks__"
+ discord/app_commands/commands.py:2410: error: Item "function" of "Union[Callable[[VarArg(Any), KwArg(Any)], Any], Callable[[Interaction, Member], Coroutine[Any, Any, Any]], Callable[[Interaction, User], Coroutine[Any, Any, Any]], Callable[[Interaction, Message], Coroutine[Any, Any, Any]]]" has no attribute "__discord_app_commands_checks__"
- discord/ext/commands/hybrid.py:85: error: The first argument to Callable must be a list of types, parameter specification, or "..."
- discord/ext/commands/hybrid.py:85: note: See https://mypy.readthedocs.io/en/stable/kinds_of_types.html#callable-types-and-lambdas
- discord/ext/commands/hybrid.py:86: error: The first argument to Callable must be a list of types, parameter specification, or "..."
- discord/ext/commands/hybrid.py:86: note: See https://mypy.readthedocs.io/en/stable/kinds_of_types.html#callable-types-and-lambdas
- discord/ext/commands/hybrid.py:793: note: def command(self, name: Union[str, locale_str] = ..., *args: Any, with_app_command: bool = ..., **kwargs: Any) -> Callable[[Union[Any, Any]], HybridCommand[CogT, P2, U]]
+ discord/ext/commands/hybrid.py:793: note: def command(self, name: Union[str, locale_str] = ..., *args: Any, with_app_command: bool = ..., **kwargs: Any) -> Callable[[Union[Callable[[VarArg(Any), KwArg(Any)], Any], Callable[[VarArg(Any), KwArg(Any)], Any]]], HybridCommand[CogT, P2, U]]
- discord/ext/commands/hybrid.py:817: note: def group(self, name: Union[str, locale_str] = ..., *args: Any, with_app_command: bool = ..., **kwargs: Any) -> Callable[[Union[Any, Any]], HybridGroup[CogT, P2, U]]
+ discord/ext/commands/hybrid.py:817: note: def group(self, name: Union[str, locale_str] = ..., *args: Any, with_app_command: bool = ..., **kwargs: Any) -> Callable[[Union[Callable[[VarArg(Any), KwArg(Any)], Any], Callable[[VarArg(Any), KwArg(Any)], Any]]], HybridGroup[CogT, P2, U]]
|
This is a bit hacky, but it does solve the problem :)
Closes #13518