mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Make sure overload checks work for TypeAlias, see #1416
This commit is contained in:
@@ -213,6 +213,9 @@ class TypeAlias(LazyValueWrapper):
|
||||
cls = next(iter(classes))
|
||||
return cls
|
||||
|
||||
def gather_annotation_classes(self):
|
||||
return ValueSet([self._get_wrapped_value()])
|
||||
|
||||
|
||||
class Callable(BaseTypingValueWithGenerics):
|
||||
def py__call__(self, arguments):
|
||||
|
||||
28
test/completion/pep0484_overload.py
Normal file
28
test/completion/pep0484_overload.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# python >= 3.4
|
||||
from typing import List, Dict, overload
|
||||
|
||||
|
||||
# -------------------------
|
||||
# With base classes
|
||||
# -------------------------
|
||||
|
||||
@overload
|
||||
def overload_f2(value: List) -> str: ...
|
||||
@overload
|
||||
def overload_f2(value: Dict) -> int: ...
|
||||
|
||||
#? str()
|
||||
overload_f2([''])
|
||||
#? int()
|
||||
overload_f2({1.0: 1.0})
|
||||
|
||||
|
||||
@overload
|
||||
def overload_f3(value: list) -> str: ...
|
||||
@overload
|
||||
def overload_f3(value: dict) -> float: ...
|
||||
|
||||
#? str()
|
||||
overload_f3([''])
|
||||
#? float()
|
||||
overload_f3({1.0: 1.0})
|
||||
Reference in New Issue
Block a user