-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Order of declarations matters, but it shouldn't #14509
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
Comments
With apologies, I haven't done a thorough search for existing bugs, because I really don't know what keywords to search for. |
Why do you think the |
@erictraut Yes, on second thoughts, you're right about If we are agreed that the error on the return statement is inappropriate, I can either edit this bug to remove the |
In the absence of feedback, I've filed a new, more concise issue (#14519). |
Bug Report
The order of declarations shouldn't matter to mypy, but in the example that follow, they do.
To Reproduce
(Exactly as written below: mypy-play.net)
(With slightly better comments, but different line numbers: mypy-play.net)
Expected Behavior
The
reveal_type
lines andfunction1
declaration, found before the class definitions, should result in the same output as those found after the class definitions.mypy's output should be (lines which differ are marked with a "
*
"):Actual Behavior
The first group of
reveal_type
lines and thefunction1
declaration misbehave, while everything after the class definitions behaves as expected.The actual output is:
Your Environment
--follow-imports=silent --show-error-codes --strict --warn-unreachable
mypy.ini
(and other config files): N/AThe text was updated successfully, but these errors were encountered: