From c65c972a1cf57c9909563b4cde95a5fb08ae973e Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Wed, 30 Sep 2020 13:51:10 +0100 Subject: [PATCH] Always type check arguments when using --disallow-untyped-calls (#9510) Fixes #9509. --- mypy/checkexpr.py | 2 +- test-data/unit/check-flags.test | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/mypy/checkexpr.py b/mypy/checkexpr.py index 1f30c78045e8..9c0e2f4048b3 100644 --- a/mypy/checkexpr.py +++ b/mypy/checkexpr.py @@ -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 diff --git a/test-data/unit/check-flags.test b/test-data/unit/check-flags.test index 7b14b2c202f2..b58320600a11 100644 --- a/test-data/unit/check-flags.test +++ b/test-data/unit/check-flags.test @@ -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'