mirror of
https://github.com/microsoft/pyright.git
synced 2024-10-26 10:55:06 +03:00
Fixed a bug that resulted in a false negative when a Literal
with multiple arguments is used in a value expression. It should be treated as a UnionType
special form in this case. This addresses #7870.
This commit is contained in:
parent
286fdf95f9
commit
ecdea2caad
@ -14897,7 +14897,13 @@ export function createTypeEvaluator(
|
||||
literalTypes.push(type);
|
||||
}
|
||||
|
||||
return combineTypes(literalTypes);
|
||||
let result = combineTypes(literalTypes);
|
||||
|
||||
if (isUnion(result) && unionClassType && isInstantiableClass(unionClassType)) {
|
||||
result = TypeBase.cloneAsSpecialForm(result, ClassType.cloneAsInstance(unionClassType));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Creates a ClassVar type.
|
||||
|
Loading…
Reference in New Issue
Block a user