mirror of
https://github.com/microsoft/pyright.git
synced 2024-09-17 11:17:17 +03:00
Fixed bug that results in a false negative when a TypeAliasType object is used in a class pattern. This addresses #7485. (#7486)
This commit is contained in:
parent
d7dc004c78
commit
18243af812
@ -1771,7 +1771,13 @@ function wrapTypeInList(evaluator: TypeEvaluator, node: ParseNode, type: Type):
|
||||
}
|
||||
|
||||
export function validateClassPattern(evaluator: TypeEvaluator, pattern: PatternClassNode) {
|
||||
const exprType = evaluator.getTypeOfExpression(pattern.className, EvaluatorFlags.CallBaseDefaults).type;
|
||||
let exprType = evaluator.getTypeOfExpression(pattern.className, EvaluatorFlags.CallBaseDefaults).type;
|
||||
|
||||
// If the expression is a type alias or other special form, treat it
|
||||
// as the special form rather than the class.
|
||||
if (exprType.specialForm) {
|
||||
exprType = exprType.specialForm;
|
||||
}
|
||||
|
||||
if (isAnyOrUnknown(exprType)) {
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user