Provide special type for typing.TypeVar as a callee (PY-28127)

This commit is contained in:
Semyon Proshev
2018-04-27 19:57:14 +03:00
parent 92073b921c
commit c1abea5187
8 changed files with 125 additions and 10 deletions
@@ -0,0 +1,33 @@
from typing import TypeVar
TypeVar("T")
TypeVar("T", int)
TypeVar("T", int, str)
TypeVar("T", bound=int)
TypeVar("T", int, bound=int)
TypeVar("T", int, str, bound=int)
TypeVar("T", <warning descr="Unexpected argument">bd=int</warning>)
TypeVar("T", int, <warning descr="Unexpected argument">bd=int</warning>)
TypeVar("T", int, str, <warning descr="Unexpected argument">bd=int</warning>)
TypeVar("T", bound=int, covariant=True)
TypeVar("T", int, bound=int, covariant=True)
TypeVar("T", int, str, bound=int, covariant=True)
TypeVar("T", bound=int, <warning descr="Unexpected argument">cant=True</warning>)
TypeVar("T", int, bound=int, <warning descr="Unexpected argument">cant=True</warning>)
TypeVar("T", int, str, bound=int, <warning descr="Unexpected argument">cant=True</warning>)
TypeVar("T", bound=int, covariant=True, contravariant=True)
TypeVar("T", int, bound=int, covariant=True, contravariant=True)
TypeVar("T", int, str, bound=int, covariant=True, contravariant=True)
TypeVar("T", bound=int, covariant=True, <warning descr="Unexpected argument">cant=True</warning>)
TypeVar("T", int, bound=int, covariant=True, <warning descr="Unexpected argument">cant=True</warning>)
TypeVar("T", int, str, bound=int, covariant=True, <warning descr="Unexpected argument">cant=True</warning>)
TypeVar("T", bound=int, covariant=True, contravariant=True, <warning descr="Unexpected argument">more=5</warning>)
TypeVar("T", int, bound=int, covariant=True, contravariant=True, <warning descr="Unexpected argument">more=5</warning>)
TypeVar("T", int, str, bound=int, covariant=True, contravariant=True, <warning descr="Unexpected argument">more=5</warning>)
@@ -0,0 +1,4 @@
from typing import TypeVar
TypeVar("T", int, str, bound=int, covariant=True, contravariant=True)
TypeVar("T", <warning descr="Expected type 'type', got 'int' instead">0</warning>, <warning descr="Expected type 'type', got 'int' instead">1</warning>, <warning descr="Expected type 'type', got 'int' instead">bound=2</warning>, <warning descr="Expected type 'bool', got 'int' instead">covariant=3</warning>, <warning descr="Expected type 'bool', got 'int' instead">contravariant=4</warning>)