Skip to content

Commit

Permalink
WIP - do not merge - see #1363
Browse files Browse the repository at this point in the history
  • Loading branch information
Guido van Rossum committed Apr 12, 2016
1 parent ac193cf commit 853df6a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mypy/checkexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,8 @@ def check_arg(self, caller_type: Type, original_caller_type: Type,
callee_type: Type, n: int, m: int, callee: CallableType,
context: Context, messages: MessageBuilder) -> None:
"""Check the type of a single argument in a call."""
if isinstance(caller_type, Instance) and caller_type.type.fallback_to_any:
return
if isinstance(caller_type, Void):
messages.does_not_return_value(caller_type, context)
elif isinstance(caller_type, DeletedType):
Expand Down
12 changes: 12 additions & 0 deletions mypy/test/data/check-expressions.test
Original file line number Diff line number Diff line change
Expand Up @@ -1382,3 +1382,15 @@ dict(undefined)
[builtins fixtures/dict.py]
[out]
main:1: error: Name 'undefined' is not defined

[case testDictInContext]
# XXX This doesn't test for the right thing.
from typing import Any, Dict
Base = None # type: Any

class Derived(Base):
def to_dict(self) -> Dict[str, Any]:
return dict(self) # fails without the hack
dict(Derived()) # fails without the hack
dict(Base()) # Always ok
[builtins fixtures/dict.py]

0 comments on commit 853df6a

Please # to comment.