Skip to content

incorrect end column for unreachable if statements #18522

Open
@A5rocks

Description

@A5rocks

Bug Report

If an if statement is unreachable, then mypy points to just the i as the error.

To Reproduce

def x() -> None:
    assert False
    if 5:
        print("yeah")

Expected Behavior

repro.py:3: error: Statement is unreachable  [unreachable]
        if 5:
        ^~~~~
Found 1 error in 1 file (checked 1 source file)

Actual Behavior

repro.py:3: error: Statement is unreachable  [unreachable]
        if 5:
        ^
Found 1 error in 1 file (checked 1 source file)

Your Environment

  • Mypy version used: master
  • Mypy command-line flags: --warn-unreachable --pretty
  • Mypy configuration options from mypy.ini (and other config files): none I think
  • Python version used: 3.12.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions