Skip to content

Commit 853df6a

Browse files
author
Guido van Rossum
committed
WIP - do not merge - see #1363
1 parent ac193cf commit 853df6a

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

mypy/checkexpr.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,8 @@ def check_arg(self, caller_type: Type, original_caller_type: Type,
627627
callee_type: Type, n: int, m: int, callee: CallableType,
628628
context: Context, messages: MessageBuilder) -> None:
629629
"""Check the type of a single argument in a call."""
630+
if isinstance(caller_type, Instance) and caller_type.type.fallback_to_any:
631+
return
630632
if isinstance(caller_type, Void):
631633
messages.does_not_return_value(caller_type, context)
632634
elif isinstance(caller_type, DeletedType):

mypy/test/data/check-expressions.test

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,3 +1382,15 @@ dict(undefined)
13821382
[builtins fixtures/dict.py]
13831383
[out]
13841384
main:1: error: Name 'undefined' is not defined
1385+
1386+
[case testDictInContext]
1387+
# XXX This doesn't test for the right thing.
1388+
from typing import Any, Dict
1389+
Base = None # type: Any
1390+
1391+
class Derived(Base):
1392+
def to_dict(self) -> Dict[str, Any]:
1393+
return dict(self) # fails without the hack
1394+
dict(Derived()) # fails without the hack
1395+
dict(Base()) # Always ok
1396+
[builtins fixtures/dict.py]

0 commit comments

Comments
 (0)