Fix missing inference for typing.Type[typing.TypeVar] (#1448)

* Add Type[TypeVar] support
* Completion tests for typing.Type[typing.TypeVar]
This commit is contained in:
Samuel Roeca
2019-11-27 16:10:58 -05:00
committed by Dave Halter
parent facd21afc6
commit 761f0828c7
3 changed files with 47 additions and 5 deletions

View File

@@ -363,6 +363,17 @@ in_out1(str())
#?
in_out1()
def type_in_out1(x: typing.Type[TYPE_VARX]) -> TYPE_VARX: ...
#? int()
type_in_out1(int)
#? str()
type_in_out1(str)
#? float()
type_in_out1(float)
#?
type_in_out1()
def in_out2(x: TYPE_VAR_CONSTRAINTSX) -> TYPE_VAR_CONSTRAINTSX: ...
#? int()
@@ -377,6 +388,18 @@ in_out2()
#? float()
in_out2(1.0)
def type_in_out2(x: typing.Type[TYPE_VAR_CONSTRAINTSX]) -> TYPE_VAR_CONSTRAINTSX: ...
#? int()
type_in_out2(int)
#? str()
type_in_out2(str)
#? str() int()
type_in_out2()
# TODO this should actually be str() int(), because of the constraints.
#? float()
type_in_out2(float)
# -------------------------
# TYPE_CHECKING
# -------------------------