-
-
Notifications
You must be signed in to change notification settings - Fork 3k
fast-parser py2 stops checking files when it hits misplaced type annotation
#1647
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
This is similar to the current behavior for a syntax error (because to the fast parser, this is a syntax error). How impactful do you find this issue? |
I see. I guess in the non fast parser the line is ignored and the function David
|
The non fast parser ignores the line entirely (which is pretty undesirable, IMO). |
Yeah. I think what confused me was the difference. It might be nice if the
|
I assume that adding a (note) message when the parser stops (or for all
"blocker" errors) would be easy.
…--Guido (mobile)
|
Yeah, that's a good idea! |
Also useful would be to keep going on other files, even though we can't continue on that one file. |
There's a concept of a "blocker" error. Once you've seen a blocker in a file it's not safe to continue checking other files that might depend on that file, so we then abandon the entire run. I think a parse error always counts as a blocker. |
Hmm, true. I'm pretty sure it would be safe to carry on as far as parsing other files, which would find more errors of the same kind, but that's probably not often enough helpful to be worth complicating the logic for. |
I'm actually puzzled, though, looking at the code -- it doesn't look like we set And I can't actually find any examples of blockers other than this one: |
I noticed when checking a large project with the fast-parser that I was getting fewer errors than with the regular parser. I then noticed the last error was
error: misplaced type annotation
Here's a repro:bar should end up showing a type error Need type annotation for variable. But instead only misplaced type annotation is shown. If you add other files to this folder and run mypy on that folder, only the single error will still show. For example:
f2.py contains:
f1.py contains the above. mypy --py2 --fast-parser f1.py f2.py will only return the single error for f1.
The text was updated successfully, but these errors were encountered: