Skip to content

Commit 7294e4d

Browse files
committed
Add isolation info to ExtInfo for SubscriptDecls
Subscripts with `isolated` arguments currently do not pass a compiler assertion about the consistency of the function type w.r.t. isolation. This is because the `ExtInfo` for `SubscriptDecl`s doesn't currently have isolation information applied (though this works in practice); annotating the `ExtInfo` with isolation allows this assertion to pass.
1 parent d2a6a7c commit 7294e4d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/Sema/TypeOfReference.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "TypeCheckType.h"
2323
#include "TypeChecker.h"
2424
#include "swift/AST/ConformanceLookup.h"
25+
#include "swift/AST/ExtInfo.h"
2526
#include "swift/AST/GenericEnvironment.h"
2627
#include "swift/AST/Effects.h"
2728
#include "swift/AST/MacroDefinition.h"
@@ -1628,6 +1629,13 @@ DeclReferenceType ConstraintSystem::getTypeOfMemberReference(
16281629
thrownErrorType = Type();
16291630
}
16301631

1632+
// Mark the isolation if any parameter is isolated.
1633+
if (llvm::any_of(indices, [&](AnyFunctionType::Param p) {
1634+
return p.isIsolated();
1635+
})) {
1636+
info = info.withIsolation(FunctionTypeIsolation::forParameter());
1637+
}
1638+
16311639
refType = FunctionType::get(indices, elementTy, info);
16321640
} else {
16331641
// Delay the adjustment for preconcurrency until after we've formed

0 commit comments

Comments
 (0)