8000 Wrong filenames reported for recursive type not supported error · Issue #4413 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Wrong filenames reported for recursive type not supported error #4413

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

Closed
mitar opened this issue Dec 29, 2017 · 2 comments
Closed

Wrong filenames reported for recursive type not supported error #4413

mitar opened this issue Dec 29, 2017 · 2 comments

Comments

@mitar
Copy link
mitar commented Dec 29, 2017

In reproduction, if you run mypy bar, you get the following error:

foo/bary.py:5: error: Recursive types not fully supported yet, nested types replaced with "Any"
foo/bary.py:9: error: Recursive types not fully supported yet, nested types replaced with "Any"

If you look carefully, you can see that the line numbers are OK, but the file reported is wrong. It should be bar/types.py. This is where recursive types are defined. In foo/bary.py they are only used. (And only used once, so if error would be about use of the recursive type and not definition, there should be only one error, not two.)

This is problematic because it is hard to silence these errors. The only way I found was to use mypy.ini and silence the whole module. And even in that case I had to silence the wrong module, foo.bary and not bar.types.

I tested this on mypy with merged #4384 and #4396.

(Reported before here, but opening now a separate issue.)

@ilevkivskyi
Copy link
Member

The problem is that currently Context only contains line and column numbers, but not the module. However, this becomes problematic if some errors are detected where types are used, but it is logical to report them at type definition context. I don't have a simple solution for this yet.

In the meantime, could you please try to find a simpler repro? (I think just two files could be enough.)

@ilevkivskyi
Copy link
Member

I think this is not relevant anymore, as we have --enable-recursive-aliases (and it hopefully will soon be on by default).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0