Skip to content

Commit 5bbf06c

Browse files
committed
Sema: use the underlying type when available instead of the structural type request
The underlying type may have been set on a validated type alias or when deserialized.
1 parent c7aa014 commit 5bbf06c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3806,8 +3806,12 @@ PotentialArchetype *GenericSignatureBuilder::realizePotentialArchetype(
38063806
}
38073807

38083808
static Type getStructuralType(TypeDecl *typeDecl) {
3809-
if (auto typealias = dyn_cast<TypeAliasDecl>(typeDecl))
3809+
if (auto typealias = dyn_cast<TypeAliasDecl>(typeDecl)) {
3810+
if (auto resolved = typealias->getUnderlyingTypeLoc().getType())
3811+
return resolved;
3812+
38103813
return typealias->getStructuralType();
3814+
}
38113815

38123816
return typeDecl->getDeclaredInterfaceType();
38133817
}

0 commit comments

Comments
 (0)