-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Describe the bug
In our code base we have a function which returns different objects based on a string provided as parameter. To provide good auto complete, our stubs make use of Literal and overload.
However, without the quotation marks, it does show all the possible outputs, but you can't use these to automatically fill the parameter:
To Reproduce
Create a function example and overload it with different Literal values. When calling the function now you can start typing quotation marks to see the possible strings to type, but you'll only be offered the last possible overload.
Expected behavior
All overloads should be offered to the autocompletion
Screenshots or Code
from typing import overload, Literal
@overload
def example(parameter: Literal["int"]) -> int: ...
@overload
def example(parameter: Literal["bool"]) -> bool: ...
@overload
def example(parameter: Literal["str"]) -> str: ...
def example(parameter):
# some logic here
return parameter
example("")VS Code extension or command-line
Using PyLance as a VSCode extension (which includes Pyright (?))

