Skip to content

Match on tuples and possibly-undefined #19391

Open
@pabloestevez94

Description

@pabloestevez94

Bug Report

On match case of tuples like
match foo, bar:

you can use case _, _: as default, but this is not working as a default for possibly-undefined error.
if you use case _: as default, is working fine.

To Reproduce

https://gist.github.com/mypy-play/2285fdbaf9db6bfc1245c29f5cd6ca3f

Expected Behavior
The gist should not raise possibly undefined

Actual Behavior

it raises possibly undefined.

Your Environment

tested on mypy playground as is in the gist.

note: on pyright works fine: https://pyright-play.net/?code=JYWwDg9gTgLgBDAnmYA7A5gKAGYQgLjjXgF44BGTAIwEMpDi4zLMQaYBjACzlwgBo4tepjhi4HGgGcApnAAMg%2BflHi1VJnABiNADazVYybLgB9QaZVr1ZACpQArjMPXMSFBgB0UGQDcZeqbuMgAUVACUQA

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-match-statementPython 3.10's match statementtopic-type-narrowingConditional type narrowing / binder

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions