Skip to content

Commit a315e44

Browse files
committed
GSB: use StructuralTypeRequest for type aliases
1 parent 09fbdc2 commit a315e44

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3805,14 +3805,9 @@ PotentialArchetype *GenericSignatureBuilder::realizePotentialArchetype(
38053805
return pa;
38063806
}
38073807

3808-
static Type getStructuralType(TypeDecl *typeDecl, LazyResolver *resolver) {
3809-
if (auto typealias = dyn_cast<TypeAliasDecl>(typeDecl)) {
3810-
// Resolve the underlying type, if we haven't done so yet.
3811-
if (!typealias->hasInterfaceType())
3812-
resolver->resolveDeclSignature(typealias);
3813-
3814-
return typealias->getUnderlyingTypeLoc().getType();
3815-
}
3808+
static Type getStructuralType(TypeDecl *typeDecl) {
3809+
if (auto typealias = dyn_cast<TypeAliasDecl>(typeDecl))
3810+
return typealias->getStructuralType();
38163811

38173812
return typeDecl->getDeclaredInterfaceType();
38183813
}
@@ -3826,7 +3821,7 @@ static Type substituteConcreteType(GenericSignatureBuilder &builder,
38263821

38273822
// Form an unsubstituted type referring to the given type declaration,
38283823
// for use in an inferred same-type requirement.
3829-
auto type = getStructuralType(concreteDecl, builder.getLazyResolver());
3824+
auto type = getStructuralType(concreteDecl);
38303825
if (!type)
38313826
return Type();
38323827

@@ -4228,10 +4223,10 @@ ConstraintResult GenericSignatureBuilder::expandConformanceRequirement(
42284223
// An inferred same-type requirement between the two type declarations
42294224
// within this protocol or a protocol it inherits.
42304225
auto addInferredSameTypeReq = [&](TypeDecl *first, TypeDecl *second) {
4231-
Type firstType = getStructuralType(first, getLazyResolver());
4226+
Type firstType = getStructuralType(first);
42324227
if (!firstType) return;
42334228

4234-
Type secondType = getStructuralType(second, getLazyResolver());
4229+
Type secondType = getStructuralType(second);
42354230
if (!secondType) return;
42364231

42374232
auto inferredSameTypeSource =

0 commit comments

Comments
 (0)