Skip to content

Wrong filenames reported for recursive type not supported error #4413

Closed
@mitar

Description

@mitar

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.)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions