Skip to content

warn_unreachable fails in trivial cases since 0.920 #11796

Closed

Description

@Richardk2n

Bug Report

In a trivial case (see below) where warn_unreachable = True results in an error up to and including 0.910, 0.920 does not.

To Reproduce

mypy.ini:

[mypy]
warn_unreachable = True

test.py:

def foo():
    return
    unreachable = 1

run mypy test.py --config-file mypy.ini
Expected Behavior

test.py:3: error: Statement is unreachable
Found 1 error in 1 file (checked 1 source file)

Actual Behavior

Success: no issues found in 1 source file

Your Environment

  • Mypy version used: 0.920
  • Mypy command-line flags: --config-file
  • Mypy configuration options from mypy.ini (and other config files): warn_unreachable = True
  • Python version used: 3.9.9
  • Operating system and version: Manjaro

Activity

  1. hauntsaninja commented on Dec 19, 2021

    @hauntsaninja
    Collaborator

    Expected, you now need --check-untyped-defs, see #10291 , and more generally https://mypy.readthedocs.io/en/stable/common_issues.html#no-errors-reported-for-obviously-wrong-code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions