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:
Eric Traut 2024-05-07 21:02:47 -07:00
parent 286fdf95f9
commit ecdea2caad

View File

@ -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.