Closed
Description
Mypy should perhaps give an error about a variable annotation in an otherwise unanotated function. Example:
def f():
a: int = 'x' # Maybe this annotation should be an error?
The rationale is that mypy will ignore the type annotation since the function is still considered unannotated, but this is confusing because there is an annotation within the function so it can appear to be annotated.
If --check-untyped-defs
is being used this error shouldn't be generated.
Originally reported in #3945.