Skip to content

Commit

Permalink
Merge pull request #18684 from github/redsun82/swift-keypath-expr
Browse files Browse the repository at this point in the history
Swift: fix `KeyPathExpr` assertion
  • Loading branch information
redsun82 authored Feb 5, 2025
2 parents ab521ff + 1a65455 commit e4523ef
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions swift/extractor/translators/ExprTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<swift::BoundGenericClassType>();
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;
Expand Down

0 comments on commit e4523ef

Please sign in to comment.