Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Allows PlaceholderNode objects before raising an error for the attempted
reuse of a member name inside an Enum.
  • Loading branch information
mrossinek committed Jan 11, 2022
1 parent 6c1eb5b commit 99a0b36
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2871,7 +2871,7 @@ def analyze_name_lvalue(self,
outer = self.is_global_or_nonlocal(name)
if kind == MDEF and isinstance(self.type, TypeInfo) and self.type.is_enum:
# Special case: we need to be sure that `Enum` keys are unique.
if existing:
if existing is not None and not isinstance(existing.node, PlaceholderNode):
self.fail('Attempted to reuse member name "{}" in Enum definition "{}"'.format(
name, self.type.name,
), lvalue)
Expand Down

0 comments on commit 99a0b36

Please sign in to comment.