Changed assignment logic to not specialize class type on RHS to allow for unspecialized type aliases.

This commit is contained in:
Eric Traut 2020-01-05 11:06:24 -07:00
parent 30eba9b67d
commit 8875b4d2bf

View File

@ -5504,9 +5504,14 @@ export function createTypeEvaluator(importLookup: ImportLookup): TypeEvaluator {
const declaredType = getDeclaredTypeForExpression(node.leftExpression);
// Evaluate the type of the right-hand side.
// Don't specialize it in case it's a type alias with no specialized
// type arguments.
let flags: EvaluatorFlags = EvaluatorFlags.DoNotSpecialize;
if (fileInfo.isStubFile) {
// An assignment of ellipsis means "Any" within a type stub file.
let srcType = getTypeOfExpression(node.rightExpression, declaredType,
fileInfo.isStubFile ? EvaluatorFlags.ConvertEllipsisToAny : undefined).type;
flags |= EvaluatorFlags.ConvertEllipsisToAny;
}
let srcType = getTypeOfExpression(node.rightExpression, declaredType, flags).type;
// Determine if the RHS is a constant boolean expression.
// If so, assign it a literal type.