Enum
plugin should support unique
check where possible
#10858
Labels
Enum
plugin should support unique
check where possible
#10858
Feature
After #10852 is merged we can work on making
@enum.unique
to check for actually unique values.Right now it does nothing. In other words, this code passes
mypy
check:But, fails in runtime:
But, since after #10852 all fields would be implicitly
final
and their values will be inferred asLiteral
types, this gives us some space to check that we haveunique
literal values insidemypy/plugins/enums.py
Corner case
We should ignore any non-
Literal
values from this check:This can even raise in runtime if
x
ory
is0
, but we have no way of knowing this in advance.Related #5599
Related #10857
The text was updated successfully, but these errors were encountered: