mirror of
https://github.com/microsoft/pyright.git
synced 2024-10-05 20:38:25 +03:00
Changed assignment logic to not specialize class type on RHS to allow for unspecialized type aliases.
This commit is contained in:
parent
30eba9b67d
commit
8875b4d2bf
@ -5504,9 +5504,14 @@ export function createTypeEvaluator(importLookup: ImportLookup): TypeEvaluator {
|
||||
const declaredType = getDeclaredTypeForExpression(node.leftExpression);
|
||||
|
||||
// Evaluate the type of the right-hand side.
|
||||
// An assignment of ellipsis means "Any" within a type stub file.
|
||||
let srcType = getTypeOfExpression(node.rightExpression, declaredType,
|
||||
fileInfo.isStubFile ? EvaluatorFlags.ConvertEllipsisToAny : undefined).type;
|
||||
// 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.
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user