Improved Generic subclass matching

This commit is contained in:
Dave Halter
2019-12-20 00:30:57 +01:00
parent 51e2e90dce
commit e56d4fde98
2 changed files with 21 additions and 1 deletions

View File

@@ -1,6 +1,9 @@
# python >= 3.4
# python >= 3.6
from typing import List, Dict, overload
lst: list
list_alias: List
list_str: List[str]
# -------------------------
# With base classes
@@ -15,6 +18,12 @@ def overload_f2(value: Dict) -> int: ...
overload_f2([''])
#? int()
overload_f2({1.0: 1.0})
#? str()
overload_f2(lst)
#? str()
overload_f2(list_alias)
#? str()
overload_f2(list_str)
@overload
@@ -26,3 +35,9 @@ def overload_f3(value: dict) -> float: ...
overload_f3([''])
#? float()
overload_f3({1.0: 1.0})
#? str()
overload_f3(lst)
#? str()
overload_f3(list_alias)
#? str()
overload_f3(list_str)