Open
Description
Bug Report
Seeing this regression on mypy 1.16 with Enums of NamedTuples values.
Note: Enums of plain classes or dataclasses work as expected.
To Reproduce
https://mypy-play.net/?mypy=1.16.0&python=3.13&flags=strict&gist=2c5d8ca22757aee67d917d8fec20ad7f
from enum import Enum
from typing import NamedTuple
class Foo(NamedTuple):
pass
class FooEnum(Foo, Enum):
ITEM = Foo()
foo: Foo = FooEnum.ITEM # works on 1.15 but not 1.16
Actual Behavior
error: Incompatible types in assignment (expression has type "FooEnum", variable has type "Foo") [assignment]
Your Environment
- Mypy version used: 1.16
- Mypy command-line flags: defaults
- Mypy configuration options from
mypy.ini
(and other config files): none - Python version used: 3.13