Skip to content

Commit

Permalink
motivate the semantic analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
tyralla committed Jul 4, 2024
1 parent 6d92318 commit afa0336
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -1435,15 +1435,17 @@ def analyze_property_with_multi_part_definition(self, defn: OverloadedFuncDef) -
for i, item in enumerate(items[1:]):
if isinstance(item, Decorator):
if len(item.decorators) >= 1:
node = item.decorators[0]
if isinstance(node, MemberExpr):
if node.name == "setter":
first_node = item.decorators[0]
if isinstance(first_node, MemberExpr):
if first_node.name == "setter":
# The first item represents the entire property.
first_item.var.is_settable_property = True
# Get abstractness from the original definition.
item.func.abstract_status = first_item.func.abstract_status
if node.name == "deleter":
if first_node.name == "deleter":
item.func.abstract_status = first_item.func.abstract_status
for other_node in item.decorators[1:]:
other_node.accept(self)
else:
self.fail(
f"Only supported top decorator is @{first_item.func.name}.setter", item
Expand Down

0 comments on commit afa0336

Please sign in to comment.