Skip to content

Always type check arguments when using --disallow-untyped-calls #9510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mypy/checkexpr.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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'