mirror of
https://github.com/microsoft/pyright.git
synced 2024-09-17 19:27:24 +03:00
Fixed a bug in the handling of dataclass
where an existing __eq__
method was being overwritten by a synthesized variant. The same was true for other comparison operators.
This commit is contained in:
parent
9bad0897c6
commit
6ed0571adf
@ -534,7 +534,10 @@ export function synthesizeDataClassMethods(
|
||||
hasDeclaredType: true,
|
||||
});
|
||||
operatorMethod.details.declaredReturnType = evaluator.getBuiltInObject(node, 'bool');
|
||||
symbolTable.set(operator, Symbol.createWithType(SymbolFlags.ClassMember, operatorMethod));
|
||||
// If a method of this name already exists, don't override it.
|
||||
if (!symbolTable.get(operator)) {
|
||||
symbolTable.set(operator, Symbol.createWithType(SymbolFlags.ClassMember, operatorMethod));
|
||||
}
|
||||
};
|
||||
|
||||
// Synthesize comparison operators.
|
||||
|
Loading…
Reference in New Issue
Block a user