Skip to content

Commit d3a0083

Browse files
committed
ReplaceOpaqueTypesWithUnderlyingTypes: Use resilience expansion instead of inlinable attribute
1 parent 898665d commit d3a0083

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/AST/Type.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2484,9 +2484,18 @@ bool ReplaceOpaqueTypesWithUnderlyingTypes::shouldPerformSubstitution(
24842484

24852485
// Allow replacement of opaque result types of inlineable function regardless
24862486
// of resilience and in which context.
2487-
if (namingDecl->getAttrs().hasAttribute<InlinableAttr>()) {
2488-
return true;
2487+
if (auto *afd = dyn_cast<AbstractFunctionDecl>(namingDecl)) {
2488+
if (afd->getResilienceExpansion() == ResilienceExpansion::Minimal) {
2489+
return true;
2490+
}
2491+
} else if (auto *asd = dyn_cast<AbstractStorageDecl>(namingDecl)) {
2492+
auto *getter = asd->getGetter();
2493+
if (getter &&
2494+
getter->getResilienceExpansion() == ResilienceExpansion::Minimal) {
2495+
return true;
2496+
}
24892497
}
2498+
24902499
// Allow replacement of opaque result types in the context of maximal
24912500
// resilient expansion if the context's and the opaque type's module are the
24922501
// same.

0 commit comments

Comments
 (0)