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 be1a005 commit c65c972
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
Expand Up @@ -317,7 +317,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
Expand Up @@ -1587,3 +1587,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 c65c972

Please sign in to comment.