Skip to content

2.1 changelog is incorrect #21561

@mristin

Description

@mristin

Bug Report

Hi! I've just installed mypy 2.1.0 and tried it against the snippet posted for the issue 16093 (#16093 (comment)).

It seems that the change is still not active in mypy 2.1.0?

The changelog states that the fix was implemented in 2.1.0:
https://mypy.readthedocs.io/en/stable/changelog.html#other-notable-fixes-and-improvements

Notably:
#21456

To Reproduce

Here's the content of the exact snippet I ran mypy on, just for reference:

from enum import Enum
from typing import assert_never


class MyEnum(Enum):
    A = 1
    B = 2
    C = 3


def my_function(a: MyEnum) -> bool:
    if a == MyEnum.A:
        return True
    elif a in (MyEnum.B, MyEnum.C):
        return False
    assert_never(a)


my_function(MyEnum.A)

Expected Behavior

I expected no error.

Actual Behavior

I get:

scratch_6.py:16: error: Argument 1 to "assert_never" has incompatible type "Literal[MyEnum.B, MyEnum.C]"; expected "Never"  [arg-type]                                                                                                                                                                            
Found 1 error in 1 file (checked 1 source file)

Your Environment

$ mypy --version
mypy 2.1.0 (compiled: yes)

Command line:

mypy --strict scratch_6.py

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