Skip to content

Commit

Permalink
fix enums created functionally and add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
terencehonles committed May 6, 2024
1 parent ba435ac commit f2cc574
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mypy/semanal_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ def build_enum_call_typeinfo(
var = Var(item)
var.info = info
var.is_property = True
# When an enum is created by its functional form `Enum(name, values)`
# - if it is a string it is first split by commas/whitespace
# - if it is an iterable of single items each item is assigned a value starting at `start`
# - if it is an iterable of (name, value) then the given values will be used
# either way, each item should be treated as if it has an explicit value.
var.has_explicit_value = True
var._fullname = f"{info.fullname}.{item}"
info.names[item] = SymbolTableNode(MDEF, var)
return info
Expand Down

0 comments on commit f2cc574

Please sign in to comment.