Skip to content
New issue

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

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

Already on GitHub? # to your account

--disallow-untyped-calls reports errors in untyped functions #12912

Open
pranavrajpal opened this issue May 31, 2022 · 0 comments
Open

--disallow-untyped-calls reports errors in untyped functions #12912

pranavrajpal opened this issue May 31, 2022 · 0 comments
Labels
bug mypy got something wrong

Comments

@pranavrajpal
Copy link
Contributor

Bug Report

Using --disallow-untyped-calls and --check-untyped-defs results in errors about calling untyped functions in a typed context, even when calling from an untyped function.

To Reproduce

Test case:

[case testDisallowUntypedCallsFromUntypedFunction]
# flags: --disallow-untyped-calls --check-untyped-defs

def f(x):
    pass

def g(y):
    f(y)

Expected Behavior

Either:

  • the documentation and the error message should be updated to specify that --disallow-untyped-calls disallows all calls to untyped functions, regardless of whether the current function has type annotations, or
  • the above code shouldn't produce any errors

Actual Behavior

The call to f in the above example produces the error "Call to untyped function "f" in typed context".

Your Environment

See https://mypy-play.net/?mypy=latest&python=3.10&flags=check-untyped-defs%2Cdisallow-untyped-calls&gist=3350fe27968b29dabc5ef1e207d008ce to reproduce.

This came up in #12901 (specifically the mypy_primer diff had an error here)

@pranavrajpal pranavrajpal added the bug mypy got something wrong label May 31, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

1 participant