Skip to content

Exhaustiveness check on match fails if subject is function call #16106

@schuelermine

Description

@schuelermine

Bug Report

Exhaustiveness check on match fails if checked expression is function call

To Reproduce

https://mypy-play.net/?mypy=latest&python=3.11&gist=e12e8ee00b037639ff0887ef65d01d11
is rejected, but
https://mypy-play.net/?mypy=latest&python=3.11&gist=22dc06422f5873e2193134da6fa574a1
is accepted

This also happens with enums

Expected Behavior

Both programs should be accepted

Actual Behavior

main.py:4: error: Missing return statement  [return]
Found 1 error in 1 file (checked 1 source file)

Your Environment

  • Mypy version used: 1.5.1
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): none
  • Python version used: 3.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong
    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