mirror of
https://github.com/microsoft/pyright.git
synced 2024-08-15 10:50:44 +03:00
Fixed bug that resulted in the incorrect synthesis of __dataclass_fields__
for named tuples. This addresses #8152.
This commit is contained in:
parent
5f47007df3
commit
48a03076a3
@ -659,10 +659,13 @@ export function synthesizeDataClassMethods(
|
||||
)
|
||||
);
|
||||
}
|
||||
symbolTable.set(
|
||||
'__dataclass_fields__',
|
||||
Symbol.createWithType(SymbolFlags.ClassMember | SymbolFlags.ClassVar, dictType)
|
||||
);
|
||||
|
||||
if (!isNamedTuple) {
|
||||
symbolTable.set(
|
||||
'__dataclass_fields__',
|
||||
Symbol.createWithType(SymbolFlags.ClassMember | SymbolFlags.ClassVar, dictType)
|
||||
);
|
||||
}
|
||||
|
||||
if (ClassType.isDataClassGenerateSlots(classType) && classType.details.localSlotsNames === undefined) {
|
||||
classType.details.localSlotsNames = localDataClassEntries.map((entry) => entry.name);
|
||||
|
Loading…
Reference in New Issue
Block a user