Skip to content
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

incorrect end column for unreachable if statements #18522

Open
A5rocks opened this issue Jan 24, 2025 · 1 comment
Open

incorrect end column for unreachable if statements #18522

A5rocks opened this issue Jan 24, 2025 · 1 comment
Labels
bug mypy got something wrong topic-error-reporting How we report errors

Comments

@A5rocks
Copy link
Collaborator

A5rocks commented Jan 24, 2025

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
@A5rocks A5rocks added bug mypy got something wrong topic-error-reporting How we report errors labels Jan 24, 2025
@A5rocks
Copy link
Collaborator Author

A5rocks commented Jan 24, 2025

I'm not sure if this is a compromise instead of showing the end as the end of the if block...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-error-reporting How we report errors
Projects
None yet
Development

No branches or pull requests

1 participant