mirror of
https://github.com/davidhalter/jedi.git
synced 2026-02-13 00:21:41 +08:00
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:
committed by
Dave Halter
parent
facd21afc6
commit
761f0828c7
@@ -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
|
||||
# -------------------------
|
||||
|
||||
Reference in New Issue
Block a user