Skip to content

--remove-unused-ignores does't remove unused ignore on line immediately before used ignore #1310

@rchen152

Description

@rchen152

Describe the Bug

Test file (named test1.py):

"""Test."""
x = 1 + 1  # pyrefly: ignore
y = 1 + "oops"  # pyrefly: ignore

Expected behavior: pyrefly should remove the first ignore, which is unused
Actual behavior:

$ pyrefly check test1.py --remove-unused-ignores
 INFO 0 errors (1 ignored)
 INFO Removed 0 unused error suppression(s) in 0 file(s)

If I put a newline between the two assignments, the first ignore is correctly removed.

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions