Skip to content

Commit 9eb87df

Browse files
committed
AST: Generalize TypeMatcher::alwaysMismatchGenericParams() to alwaysMismatchTypeParameters()
1 parent f39a0a8 commit 9eb87df

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

include/swift/AST/TypeMatcher.h

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,25 @@ class TypeMatcher {
195195
TRIVIAL_CASE(ModuleType)
196196
TRIVIAL_CASE(DynamicSelfType)
197197
TRIVIAL_CASE(ArchetypeType)
198-
TRIVIAL_CASE(DependentMemberType)
198+
199+
bool visitDependentMemberType(CanDependentMemberType firstType,
200+
Type secondType,
201+
Type sugaredFirstType) {
202+
/* If the types match, continue. */
203+
if (!Matcher.asDerived().alwaysMismatchTypeParameters() &&
204+
firstType->isEqual(secondType))
205+
return true;
206+
207+
/* Otherwise, let the derived class deal with the mismatch. */
208+
return mismatch(firstType.getPointer(), secondType,
209+
sugaredFirstType);
210+
}
199211

200212
bool visitGenericTypeParamType(CanGenericTypeParamType firstType,
201213
Type secondType,
202214
Type sugaredFirstType) {
203215
/* If the types match, continue. */
204-
if (!Matcher.asDerived().alwaysMismatchGenericParams() &&
216+
if (!Matcher.asDerived().alwaysMismatchTypeParameters() &&
205217
firstType->isEqual(secondType))
206218
return true;
207219

@@ -312,7 +324,7 @@ class TypeMatcher {
312324
#undef TRIVIAL_CASE
313325
};
314326

315-
bool alwaysMismatchGenericParams() const { return false; }
327+
bool alwaysMismatchTypeParameters() const { return false; }
316328

317329
ImplClass &asDerived() { return static_cast<ImplClass &>(*this); }
318330

lib/AST/RequirementMachine/PropertyMap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ static bool unifyConcreteTypes(
387387
rhsSubstitutions(rhsSubstitutions),
388388
ctx(ctx), inducedRules(inducedRules), debug(debug) {}
389389

390-
bool alwaysMismatchGenericParams() const { return true; }
390+
bool alwaysMismatchTypeParameters() const { return true; }
391391

392392
bool mismatch(TypeBase *firstType, TypeBase *secondType,
393393
Type sugaredFirstType) {

0 commit comments

Comments
 (0)