Skip to content

Commit 498769b

Browse files
committed
Always type check arguments when using --disallow-untyped-calls (python#9510)
Fixes python#9509.
1 parent ab114f3 commit 498769b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

mypy/checkexpr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def visit_call_expr_inner(self, e: CallExpr, allow_none_return: bool = False) ->
314314
self.chk.in_checked_function() and
315315
isinstance(callee_type, CallableType)
316316
and callee_type.implicit):
317-
return self.msg.untyped_function_call(callee_type, e)
317+
self.msg.untyped_function_call(callee_type, e)
318318
# Figure out the full name of the callee for plugin lookup.
319319
object_type = None
320320
member = None

test-data/unit/check-flags.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,3 +1575,12 @@ def bad_return_type() -> str:
15751575
return None # E: Incompatible return value type (got "None", expected "str") [return-value]
15761576

15771577
bad_return_type('no args taken!')
1578+
1579+
[case testDisallowUntypedCallsArgType]
1580+
# flags: --disallow-untyped-calls
1581+
def f(x):
1582+
pass
1583+
1584+
y = 1
1585+
f(reveal_type(y)) # E: Call to untyped function "f" in typed context \
1586+
# N: Revealed type is 'builtins.int'

0 commit comments

Comments
 (0)
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