File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
crates/ty_python_semantic Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,10 @@ class Base:
7474class RegularClassAttributeOverride (Base ):
7575 class_attr = 1
7676
77+ class AugmentedClassAttributeOverride (Base ):
78+ class_attr = 1
79+ class_attr += 1
80+
7781class RegularClassAttributeBase :
7882 attr = 1
7983
Original file line number Diff line number Diff line change @@ -499,12 +499,16 @@ fn check_class_declaration<'db>(
499499 && subclass_kind != superclass_variable_kind
500500 {
501501 // An unannotated class-body assignment can inherit an overridden `ClassVar`
502- // declaration instead of introducing a conflicting instance variable.
502+ // declaration instead of introducing a conflicting instance variable. This
503+ // also applies to augmented assignments after the initial class-body
504+ // assignment, e.g. `epilog = "..."; epilog += "..."`.
503505 if subclass_kind == VariableKind :: Instance
504506 && superclass_variable_kind == VariableKind :: Class
505- && first_reachable_definition
506- . kind ( db)
507- . is_unannotated_assignment ( )
507+ && matches ! (
508+ first_reachable_definition. kind( db) ,
509+ DefinitionKind :: Assignment ( _)
510+ | DefinitionKind :: AugmentedAssignment ( _)
511+ )
508512 {
509513 continue ;
510514 }
You can’t perform that action at this time.
0 commit comments