Skip to content

Unused error code(s) in # pyrefly: ignore: unused-ignore #3367

@jorenham

Description

@jorenham

Describe the Bug

There's currently a false positive bad-specialization error (#3329 (comment)) in scipy-stubs that's only reported for numpy>=2.1. But if I ignore it with # pyrefly:ignore [bad-specialization], then the CI jobs for numpy<2.1 fail because there it will report an unused-error error. (CI logs: https://github.com/scipy/scipy-stubs/actions/runs/25760598778/job/75660439117?pr=1593)
However, when I then add another ignore comment for unused-error, Pyrefly will report "Unused error code(s) in # pyrefly: ignore: unused-ignore" with numpy>=2.1.

I expected that # pyrefly:ignore[unused-error] would also apply to itself. But apparently it doesn't.
This means that I have no way to # pyrefly: ignore my way of out this situation, without it leading to an error in one of the CI jobs.

Of course I could ignore this false positive in the pyproject.toml, but I'd rather not, because that means that any other, possibly true positive, bad-specialization errors, will also be ignored.

So what are your thoughts on changing # pyrefly:ignore[unused-ignore] so that it'll also apply to itself? And just to be clear: I'm not suggesting that we also exclude this from --remove-unused-ignore or something (because that's generally not something you'd run in CI) -- I'm only talking about the error reporting part.

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions