From 0e19ee370a69fc75502324bbbb00af901181e929 Mon Sep 17 00:00:00 2001 From: detachhead Date: Fri, 5 Jul 2024 20:29:15 +1000 Subject: [PATCH] Revert "Fixed recent regression that results in a runtime assert (and therefore a crash) in certain circumstances when computing the MRO for a class. This addresses #8191." This reverts commit 1bbb5d90a17025ec73a3695c8f9fe09ffc282049. --- packages/pyright-internal/src/analyzer/typeUtils.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/pyright-internal/src/analyzer/typeUtils.ts b/packages/pyright-internal/src/analyzer/typeUtils.ts index ec81799ca0..c324766d7a 100644 --- a/packages/pyright-internal/src/analyzer/typeUtils.ts +++ b/packages/pyright-internal/src/analyzer/typeUtils.ts @@ -3114,11 +3114,8 @@ export function computeMroLinearization(classType: ClassType): boolean { // The first class in the MRO is the class itself. const typeVarContext = buildTypeVarContextFromSpecializedClass(classType); - let specializedClassType = applySolvedTypeVars(classType, typeVarContext); - if (!isClass(specializedClassType) && !isAny(specializedClassType) && !isUnknown(specializedClassType)) { - specializedClassType = UnknownType.create(); - } - + const specializedClassType = applySolvedTypeVars(classType, typeVarContext); + assert(isClass(specializedClassType) || isAny(specializedClassType) || isUnknown(specializedClassType)); classType.details.mro.push(specializedClassType); // Helper function that returns true if the specified searchClass