Fixed a crashing bug that results from an internal assertion failure when a generic class that uses PEP 695 syntax is located within an unreachable code block. This addresses #7828.

This commit is contained in:
Eric Traut 2024-05-01 18:33:20 -07:00
parent 66ebc186e1
commit bdc4b2650f

View File

@ -17132,10 +17132,9 @@ export function createTypeEvaluator(
function evaluateTypeParameterList(node: TypeParameterListNode): TypeVarType[] {
const paramTypes: TypeVarType[] = [];
const typeParamScope = AnalyzerNodeInfo.getScope(node);
assert(typeParamScope !== undefined);
node.parameters.forEach((param) => {
const paramSymbol = typeParamScope.symbolTable.get(param.name.value);
const paramSymbol = typeParamScope?.symbolTable.get(param.name.value);
if (!paramSymbol) {
// This can happen if the code is unreachable.
return;