Skip to content
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

Fix detecting missing parameter/return type annotations with fast parser #2623

Merged
merged 1 commit into from Jan 2, 2017

Conversation

jstasiak
Copy link
Contributor

Some test code:

    # test.py
    def f1(i) -> None:
        pass

    def f2(i: int):
        pass

    def f3():
        pass

Without fast parser the detection was working just fine:

    % mypy --disallow-untyped-defs test.py
    test.py: note: In function "f1":
    test.py:1: error: Function is missing a type annotation for one or more arguments
    test.py: note: In function "f2":
    test.py:5: error: Function is missing a return type annotation
    test.py: note: In function "f3":
    test.py:9: error: Function is missing a type annotation

With fast parser, however, functions missing only parameter or only
return type annotation would remain undetected:

    % mypy --disallow-untyped-defs --fast-parser test.py
    test.py: note: In function "f3":
    test.py:9: error: Function is missing a type annotation

Some test code:

    # test.py
    def f1(i) -> None:
        pass

    def f2(i: int):
        pass

    def f3():
        pass

Without fast parser the detection was working just fine:

    % mypy --disallow-untyped-defs test.py
    test.py: note: In function "f1":
    test.py:1: error: Function is missing a type annotation for one or more arguments
    test.py: note: In function "f2":
    test.py:5: error: Function is missing a return type annotation
    test.py: note: In function "f3":
    test.py:9: error: Function is missing a type annotation

With fast parser, however, functions missing only parameter or only
return type annotation would remain undetected:

    % mypy --disallow-untyped-defs --fast-parser test.py
    test.py: note: In function "f3":
    test.py:9: error: Function is missing a type annotation
Copy link
Contributor

@ambv ambv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@gvanrossum gvanrossum merged commit 11303c2 into python:master Jan 2, 2017
@jstasiak jstasiak deleted the missing-annotations-fast-parser branch January 12, 2017 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants