Skip to content

Commit df17f19

Browse files
author
Amritpan Kaur
committed
[ConstraintSystem] Set up key path root lookups.
1 parent 9b39805 commit df17f19

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3031,6 +3031,20 @@ class ConstraintSystem {
30313031
return std::get<1>(result->second);
30323032
return nullptr;
30333033
}
3034+
3035+
TypeVariableType *getKeyPathRootType(const KeyPathExpr *keyPath) const {
3036+
auto result = getKeyPathRootTypeIfAvailable(keyPath);
3037+
assert(result);
3038+
return result;
3039+
}
3040+
3041+
TypeVariableType *
3042+
getKeyPathRootTypeIfAvailable(const KeyPathExpr *keyPath) const {
3043+
auto result = KeyPaths.find(keyPath);
3044+
if (result != KeyPaths.end())
3045+
return std::get<0>(result->second);
3046+
return nullptr;
3047+
}
30343048

30353049
TypeBase* getFavoredType(Expr *E) {
30363050
assert(E != nullptr);

0 commit comments

Comments
 (0)