mypy icon indicating copy to clipboard operation
mypy copied to clipboard

Support enum Literals in the enum plugin

Open A5rocks opened this issue 2 years ago • 1 comments

This makes the enum plugin (e.g. .name and .value) work on enum Literals.

Fixes https://github.com/python/mypy/issues/14092

A5rocks avatar Jul 11 '23 07:07 A5rocks

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

github-actions[bot] avatar Jul 11 '23 08:07 github-actions[bot]

While at it, should we mention something in https://mypy.readthedocs.io/en/stable/literal_types.html about being able to use enums as literals?

ikonst avatar Jul 13 '23 05:07 ikonst

While at it, should we mention something in https://mypy.readthedocs.io/en/stable/literal_types.html about being able to use enums as literals?

I don't think the enum plugin is mentioned there already (i.e. specifically .value and .name behavior) so I'm not going to update it.

A5rocks avatar Jul 18 '23 06:07 A5rocks

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

github-actions[bot] avatar Jul 18 '23 06:07 github-actions[bot]

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

github-actions[bot] avatar Jul 18 '23 06:07 github-actions[bot]

I don't think the enum plugin is mentioned there already (i.e. specifically .value and .name behavior) so I'm not going to update it.

One thing that worries me is that we don't have a good way to track documenting user-facing changes.

ikonst avatar Aug 15 '23 15:08 ikonst