Skip to content

Commit e4523ef

Browse files
authored
Merge pull request #18684 from github/redsun82/swift-keypath-expr
Swift: fix `KeyPathExpr` assertion
2 parents ab521ff + 1a65455 commit e4523ef

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

swift/extractor/translators/ExprTranslator.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -379,12 +379,7 @@ codeql::KeyPathExpr ExprTranslator::translateKeyPathExpr(const swift::KeyPathExp
379379
entry.components.push_back(emitKeyPathComponent(component));
380380
}
381381
if (auto rootTypeRepr = expr.getExplicitRootType()) {
382-
auto keyPathType = expr.getType()->getAs<swift::BoundGenericClassType>();
383-
CODEQL_EXPECT_OR(return entry, keyPathType, "KeyPathExpr must have BoundGenericClassType");
384-
auto keyPathTypeArgs = keyPathType->getGenericArgs();
385-
CODEQL_EXPECT_OR(return entry, keyPathTypeArgs.size() != 0,
386-
"KeyPathExpr type must have generic args");
387-
entry.root = dispatcher.fetchLabel(rootTypeRepr, keyPathTypeArgs[0]);
382+
entry.root = dispatcher.fetchLabel(rootTypeRepr, expr.getRootType());
388383
}
389384
}
390385
return entry;

0 commit comments

Comments
 (0)