-
Notifications
You must be signed in to change notification settings - Fork 767
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Autocomplete for function definition using a TypeAlias is broken #5464
Comments
Thanks to @davep for coming up with the MRE code. |
Thank you for reporting this issue. Our current design is to print the original return type instead of the type alias for overridden methods. I don't consider it a bug, but tagging @heejaechang to see if he has a different perspective. |
Thanks, @StellaHuang95! Is there a rationale for this? The tooltip that appears when you are in the process of overriding a method does show the type alias. When you subclass something, you're probably not interested in returning the original type, but in the type alias. You may not even know or understand what the original type is. |
Ran into this problem a few more times while creating subclasses. Whenever I override def __init__(
self,
*content: Option | Separator | None | ConsoleRenderable | RichCast | str,
tooltip: ConsoleRenderable | RichCast | str | None = None,
): while this is the original class definition: def __init__(
self,
*content: NewOptionListContent,
tooltip: RenderableType | None = None,
): (I removed some other parameters which were simple types and thus unchanged.) Since I just want to subclass something, I don't want the type definition to change. That confuses my users... |
Thanks for the clarification. We could potentially add a setting to control the printed return type to be either original type or type alias. Moving this issue to discussion as an enhancement request for comments and upvotes. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Environment data
Code Snippet
Consider this definition:
Repro Steps
Thing
.list[int]
instead ofThing
.Expected behavior
Expected output:
Actual behavior
Logs
Could not create the issue with the logs; they were too long although I cleared the log output, enabled the trace setting, pressed n and tab and copied the resulting logs. Not sure what part I'll have to paste from the logs...
The text was updated successfully, but these errors were encountered: