Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mypy/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def format_simple(self, typ: Type, verbosity: int = 0) -> str:
for arg in itype.args:
a.append(strip_quotes(self.format(arg)))
s = ', '.join(a)
if len((base_str + s)) < 25:
if len((base_str + s)) < 150:
return '{}[{}]'.format(base_str, s)
else:
return '{}[...]'.format(base_str)
Expand All @@ -250,7 +250,7 @@ def format_simple(self, typ: Type, verbosity: int = 0) -> str:
for t in typ.items:
items.append(strip_quotes(self.format(t)))
s = '"Tuple[{}]"'.format(', '.join(items))
if len(s) < 40:
if len(s) < 400:
return s
else:
return 'tuple(length {})'.format(len(items))
Expand Down
2 changes: 1 addition & 1 deletion test-data/unit/check-async-await.test
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def plain_host_generator() -> Generator[str, None, None]:
x = yield from plain_generator()
x = yield from plain_coroutine() # E: "yield from" can't be applied to Awaitable[int]
x = yield from decorated_generator()
x = yield from decorated_coroutine() # E: "yield from" can't be applied to AwaitableGenerator[...]
x = yield from decorated_coroutine() # E: "yield from" can't be applied to AwaitableGenerator[Any, Any, int, Awaitable[int]]
x = yield from other_iterator()
x = yield from other_coroutine() # E: "yield from" can't be applied to "Aw"

Expand Down
31 changes: 25 additions & 6 deletions test-data/unit/check-generics.test
Original file line number Diff line number Diff line change
Expand Up @@ -533,14 +533,33 @@ D = TypeVar('D')
E = TypeVar('E')
F = TypeVar('F')
G = TypeVar('G')
class O: pass
a = None # type: A[object, object, object, object, object, object]
H = TypeVar('H')
I = TypeVar('I')
J = TypeVar('J')
K = TypeVar('K')
L = TypeVar('L')
M = TypeVar('M')
N = TypeVar('N')
O = TypeVar('O')
P = TypeVar('P')
Q = TypeVar('Q')
R = TypeVar('R')
S = TypeVar('S')
T = TypeVar('T')
U = TypeVar('U')
V = TypeVar('V')
W = TypeVar('W')
X = TypeVar('X')
Y = TypeVar('Y')
Z = TypeVar('Z')
class OO: pass
a = None # type: A[object, object, object, object, object, object, object, object, object, object, object, object, object, object, object, object, object, object, object, object, object, object, object, object, object]

f(a) # E: Argument 1 to "f" has incompatible type A[...]; expected "O"
f(a) # E: Argument 1 to "f" has incompatible type A[...]; expected "OO"

def f(a: O) -> None:
def f(a: OO) -> None:
pass
class A(Generic[B, C, D, E, F, G]): pass
class A(Generic[B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z]): pass

[case testErrorWithShorterGenericTypeName]
from typing import TypeVar, Generic
Expand All @@ -558,7 +577,7 @@ from typing import Callable, TypeVar, Generic
S = TypeVar('S')
T = TypeVar('T')
a = None # type: A[object, Callable[[], None]]
f(a) # E: Argument 1 to "f" has incompatible type A[...]; expected "B"
f(a) # E: Argument 1 to "f" has incompatible type A[object, Callable[[], None]]; expected "B"

def f(a: 'B') -> None: pass
class A(Generic[S, T]): pass
Expand Down
4 changes: 2 additions & 2 deletions test-data/unit/check-tuples.test
Original file line number Diff line number Diff line change
Expand Up @@ -573,13 +573,13 @@ class A:
[case testLargeTuplesInErrorMessages]

a = None # type: LongTypeName
a + (a, a, a, a, a, a, a) # Fail
a + (a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a) # Fail

class LongTypeName:
def __add__(self, x: 'LongTypeName') -> 'LongTypeName': pass
[builtins fixtures/tuple.pyi]
[out]
main:3: error: Unsupported operand types for + ("LongTypeName" and tuple(length 7))
main:3: error: Unsupported operand types for + ("LongTypeName" and tuple(length 50))


-- Tuple methods
Expand Down
2 changes: 1 addition & 1 deletion test-data/unit/pythoneval-asyncio.test
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ loop.run_until_complete(h())
loop.close()
[out]
_program.py: note: In function "h3":
_program.py:18: error: Incompatible return value type (got Future[Future[int]], expected Future[...])
_program.py:18: error: Incompatible return value type (got Future[Future[int]], expected Future[Future[Future[int]]])

[case testErrorOneLessFutureInReturnType]
import typing
Expand Down