Skip to content

Commit da6cf5e

Browse files
committed
TypeAliasDecl::getStructuralType returns a validated type if available
1 parent a268e0c commit da6cf5e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/AST/Decl.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3624,7 +3624,10 @@ UnboundGenericType *TypeAliasDecl::getUnboundGenericType() const {
36243624

36253625
Type TypeAliasDecl::getStructuralType() const {
36263626
assert(!getGenericParams());
3627-
3627+
3628+
if (auto resolved = this->getUnderlyingTypeLoc().getType())
3629+
return resolved;
3630+
36283631
auto &context = getASTContext();
36293632
return evaluateOrDefault(context.evaluator,
36303633
StructuralTypeRequest { const_cast<TypeAliasDecl *>(this) },

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3785,9 +3785,6 @@ PotentialArchetype *GenericSignatureBuilder::realizePotentialArchetype(
37853785

37863786
static Type getStructuralType(TypeDecl *typeDecl) {
37873787
if (auto typealias = dyn_cast<TypeAliasDecl>(typeDecl)) {
3788-
if (auto resolved = typealias->getUnderlyingTypeLoc().getType())
3789-
return resolved;
3790-
37913788
return typealias->getStructuralType();
37923789
}
37933790

0 commit comments

Comments
 (0)