From 1a654557a9de51c5d1392ce47c81611f5bcaba60 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Wed, 5 Feb 2025 10:41:59 +0100 Subject: [PATCH] Swift: fix `KeyPathExpr` assertion --- swift/extractor/translators/ExprTranslator.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/swift/extractor/translators/ExprTranslator.cpp b/swift/extractor/translators/ExprTranslator.cpp index cfdc7d8fae0b..2da23e9c0afb 100644 --- a/swift/extractor/translators/ExprTranslator.cpp +++ b/swift/extractor/translators/ExprTranslator.cpp @@ -379,12 +379,7 @@ codeql::KeyPathExpr ExprTranslator::translateKeyPathExpr(const swift::KeyPathExp entry.components.push_back(emitKeyPathComponent(component)); } if (auto rootTypeRepr = expr.getExplicitRootType()) { - auto keyPathType = expr.getType()->getAs(); - CODEQL_EXPECT_OR(return entry, keyPathType, "KeyPathExpr must have BoundGenericClassType"); - auto keyPathTypeArgs = keyPathType->getGenericArgs(); - CODEQL_EXPECT_OR(return entry, keyPathTypeArgs.size() != 0, - "KeyPathExpr type must have generic args"); - entry.root = dispatcher.fetchLabel(rootTypeRepr, keyPathTypeArgs[0]); + entry.root = dispatcher.fetchLabel(rootTypeRepr, expr.getRootType()); } } return entry;