From 9a3cdb7e13d5cb6e0b7e3cc4b9c2f3dc9358fff0 Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Wed, 30 Sep 2020 12:51:03 +0100 Subject: [PATCH] Always type check arguments when using --disallow-untyped-calls 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' pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy