Skip to content

Commit bed33d8

Browse files
committed
GSB: Don't compute anchors in resolveDependentMemberTypes()
When a concrete type contains unresolved DependentMemberTypes, we don't need to replace them with their anchor, just the resolved representative from the PotentialArchetype. This means that the only time we compute anchors are when computing canonical types (which is only done after a GSB has been finalized) and when adding same-type requirements. This should eventually enable building the same-type rewrite system in one shot.
1 parent 87cf15a commit bed33d8

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3777,12 +3777,10 @@ static Type resolveDependentMemberTypes(
37773777
return concreteType;
37783778

37793779
// Map the type parameter to an equivalence class.
3780-
auto equivClass = resolved.getEquivalenceClass(builder);
3781-
if (!equivClass)
3782-
return ErrorType::get(Type(type));
3780+
auto equivClass = resolved.getEquivalenceClassIfPresent();
37833781

37843782
// If there is a concrete type in this equivalence class, use that.
3785-
if (equivClass->concreteType) {
3783+
if (equivClass && equivClass->concreteType) {
37863784
// .. unless it's recursive.
37873785
if (equivClass->recursiveConcreteType)
37883786
return ErrorType::get(Type(type));
@@ -3797,7 +3795,7 @@ static Type resolveDependentMemberTypes(
37973795
resolutionKind);
37983796
}
37993797

3800-
return equivClass->getAnchor(builder, builder.getGenericParams());
3798+
return resolved.getDependentType(builder);
38013799
});
38023800
}
38033801

0 commit comments

Comments
 (0)