@@ -4479,8 +4479,7 @@ namespace {
4479
4479
buildKeyPathPropertyComponent (const SelectedOverload &overload,
4480
4480
SourceLoc componentLoc,
4481
4481
ConstraintLocator *locator) {
4482
- if (overload.choice .isDecl ()) {
4483
- auto property = overload.choice .getDecl ();
4482
+ if (auto *property = overload.choice .getDeclOrNull ()) {
4484
4483
// Key paths can only refer to properties currently.
4485
4484
auto varDecl = cast<VarDecl>(property);
4486
4485
// Key paths don't work with mutating-get properties.
@@ -4784,10 +4783,8 @@ static ConcreteDeclRef resolveLocatorToDecl(
4784
4783
// Overloaded and unresolved cases: find the resolved overload.
4785
4784
auto anchorLocator = cs.getConstraintLocator (anchor);
4786
4785
if (auto selected = findOvlChoice (anchorLocator)) {
4787
- if (selected->choice .isDecl ())
4788
- return getConcreteDeclRef (selected->choice .getDecl (),
4789
- selected->openedType ,
4790
- anchorLocator);
4786
+ if (auto *decl = selected->choice .getDeclOrNull ())
4787
+ return getConcreteDeclRef (decl, selected->openedType , anchorLocator);
4791
4788
}
4792
4789
}
4793
4790
@@ -4796,10 +4793,8 @@ static ConcreteDeclRef resolveLocatorToDecl(
4796
4793
auto anchorLocator = cs.getConstraintLocator (anchor,
4797
4794
ConstraintLocator::UnresolvedMember);
4798
4795
if (auto selected = findOvlChoice (anchorLocator)) {
4799
- if (selected->choice .isDecl ())
4800
- return getConcreteDeclRef (selected->choice .getDecl (),
4801
- selected->openedType ,
4802
- anchorLocator);
4796
+ if (auto *decl = selected->choice .getDeclOrNull ())
4797
+ return getConcreteDeclRef (decl, selected->openedType , anchorLocator);
4803
4798
}
4804
4799
}
4805
4800
@@ -4808,10 +4803,8 @@ static ConcreteDeclRef resolveLocatorToDecl(
4808
4803
auto anchorLocator = cs.getConstraintLocator (anchor,
4809
4804
ConstraintLocator::Member);
4810
4805
if (auto selected = findOvlChoice (anchorLocator)) {
4811
- if (selected->choice .isDecl ())
4812
- return getConcreteDeclRef (selected->choice .getDecl (),
4813
- selected->openedType ,
4814
- anchorLocator);
4806
+ if (auto *decl = selected->choice .getDeclOrNull ())
4807
+ return getConcreteDeclRef (decl, selected->openedType , anchorLocator);
4815
4808
}
4816
4809
}
4817
4810
@@ -4824,10 +4817,8 @@ static ConcreteDeclRef resolveLocatorToDecl(
4824
4817
auto anchorLocator =
4825
4818
cs.getConstraintLocator (anchor, ConstraintLocator::SubscriptMember);
4826
4819
if (auto selected = findOvlChoice (anchorLocator)) {
4827
- if (selected->choice .isDecl ())
4828
- return getConcreteDeclRef (selected->choice .getDecl (),
4829
- selected->openedType ,
4830
- anchorLocator);
4820
+ if (auto *decl = selected->choice .getDeclOrNull ())
4821
+ return getConcreteDeclRef (decl, selected->openedType , anchorLocator);
4831
4822
}
4832
4823
}
4833
4824
0 commit comments