mirror of
https://github.com/microsoft/pyright.git
synced 2024-09-11 07:55:56 +03:00
Fixed a bug that led to a false positive error when using a type alias within an __init__
or __hash__
method in a dataclass. This addresses https://github.com/microsoft/pyright/issues/4596.
This commit is contained in:
parent
ceb2a2d5a4
commit
f3a7ba79f1
@ -16210,24 +16210,14 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
|
||||
if (!skipSynthesizedInit) {
|
||||
const initSymbol = lookUpClassMember(classType, '__init__', ClassMemberLookupFlags.SkipBaseClasses);
|
||||
if (initSymbol) {
|
||||
const initSymbolType = getTypeOfMember(initSymbol);
|
||||
if (isFunction(initSymbolType)) {
|
||||
if (!FunctionType.isSynthesizedMethod(initSymbolType)) {
|
||||
hasExistingInitMethod = true;
|
||||
}
|
||||
} else {
|
||||
hasExistingInitMethod = true;
|
||||
}
|
||||
hasExistingInitMethod = true;
|
||||
}
|
||||
}
|
||||
|
||||
let skipSynthesizeHash = false;
|
||||
const hashSymbol = lookUpClassMember(classType, '__hash__', ClassMemberLookupFlags.SkipBaseClasses);
|
||||
if (hashSymbol) {
|
||||
const hashSymbolType = getTypeOfMember(hashSymbol);
|
||||
if (isFunction(hashSymbolType) && !FunctionType.isSynthesizedMethod(hashSymbolType)) {
|
||||
skipSynthesizeHash = true;
|
||||
}
|
||||
skipSynthesizeHash = true;
|
||||
}
|
||||
|
||||
synthesizeDataClassMethods(
|
||||
|
Loading…
Reference in New Issue
Block a user