@@ -8865,13 +8865,6 @@ static ConstraintFix *validateInitializerRef(ConstraintSystem &cs,
8865
8865
return cs.simplifyType(cs.getType(expr))->getRValueType();
8866
8866
};
8867
8867
8868
- auto locatorEndsWith =
8869
- [](ConstraintLocator *locator,
8870
- ConstraintLocator::PathElementKind eltKind) -> bool {
8871
- auto path = locator->getPath();
8872
- return !path.empty() && path.back().getKind() == eltKind;
8873
- };
8874
-
8875
8868
Expr *baseExpr = nullptr;
8876
8869
Type baseType;
8877
8870
@@ -8928,7 +8921,7 @@ static ConstraintFix *validateInitializerRef(ConstraintSystem &cs,
8928
8921
// member.
8929
8922
// We need to find type variable which represents contextual base.
8930
8923
auto *baseLocator = cs.getConstraintLocator(
8931
- UME, locatorEndsWith( locator, ConstraintLocator ::ConstructorMember)
8924
+ UME, locator->isLastElement<LocatorPathElt ::ConstructorMember>( )
8932
8925
? ConstraintLocator::UnresolvedMember
8933
8926
: ConstraintLocator::MemberRefBase);
8934
8927
@@ -8943,7 +8936,7 @@ static ConstraintFix *validateInitializerRef(ConstraintSystem &cs,
8943
8936
baseType = cs.simplifyType(*result)->getRValueType();
8944
8937
// Constraint for member base is formed as '$T.Type[.<member] = ...`
8945
8938
// which means MetatypeType has to be added after finding a type variable.
8946
- if (locatorEndsWith( baseLocator, ConstraintLocator ::MemberRefBase))
8939
+ if (baseLocator->isLastElement<LocatorPathElt ::MemberRefBase>( ))
8947
8940
baseType = MetatypeType::get(baseType);
8948
8941
} else if (auto *keyPathExpr = getAsExpr<KeyPathExpr>(anchor)) {
8949
8942
// Key path can't refer to initializers e.g. `\Type.init`
0 commit comments