Skip to content

Commit

Permalink
Always type check arguments when using --disallow-untyped-calls (#9510)
Browse files Browse the repository at this point in the history
Fixes #9509.
  • Loading branch information
JukkaL committed Sep 30, 2020
1 parent ab114f3 commit 498769b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mypy/checkexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def visit_call_expr_inner(self, e: CallExpr, allow_none_return: bool = False) ->
self.chk.in_checked_function() and
isinstance(callee_type, CallableType)
and callee_type.implicit):
return self.msg.untyped_function_call(callee_type, e)
self.msg.untyped_function_call(callee_type, e)
# Figure out the full name of the callee for plugin lookup.
object_type = None
member = None
Expand Down
9 changes: 9 additions & 0 deletions test-data/unit/check-flags.test
Original file line number Diff line number Diff line change
Expand Up @@ -1575,3 +1575,12 @@ def bad_return_type() -> str:
return None # E: Incompatible return value type (got "None", expected "str") [return-value]

bad_return_type('no args taken!')

[case testDisallowUntypedCallsArgType]
# flags: --disallow-untyped-calls
def f(x):
pass

y = 1
f(reveal_type(y)) # E: Call to untyped function "f" in typed context \
# N: Revealed type is 'builtins.int'

0 comments on commit 498769b

Please sign in to comment.