Skip to content

Commit d666b04

Browse files
author
Amritpan Kaur
committed
[ConstraintSystem] Setup key path expr lookups.
1 parent 39ddadc commit d666b04

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
@@ -3014,6 +3014,20 @@ class ConstraintSystem {
30143014
return nullptr;
30153015
}
30163016

3017+
TypeVariableType *getKeyPathValueType(const KeyPathExpr *keyPath) const {
3018+
auto result = getKeyPathValueTypeIfAvailable(keyPath);
3019+
assert(result);
3020+
return result;
3021+
}
3022+
3023+
TypeVariableType *
3024+
getKeyPathValueTypeIfAvailable(const KeyPathExpr *keyPath) const {
3025+
auto result = KeyPaths.find(keyPath);
3026+
if (result != KeyPaths.end())
3027+
return std::get<1>(result->second);
3028+
return nullptr;
3029+
}
3030+
30173031
TypeBase* getFavoredType(Expr *E) {
30183032
assert(E != nullptr);
30193033
return this->FavoredTypes[E];

0 commit comments

Comments
 (0)