Skip to content

Commit 969dd69

Browse files
committed
[region-isolation] Fix thinko.
The thinko was that rather than use the actual isolated parameter of a partial apply as the isolated parameter, I instead just used the last operand... :doh:. This fixes: rdar://126297097
1 parent 2e5b3bc commit 969dd69

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/SILOptimizer/Utils/PartitionUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ SILIsolationInfo SILIsolationInfo::get(SILInstruction *inst) {
105105
for (auto &op : as.getArgumentOperands()) {
106106
if (as.getArgumentParameterInfo(op).hasOption(
107107
SILParameterInfo::Isolated)) {
108-
actorInstance = pai->getAllOperands().back().get();
108+
actorInstance = op.get();
109109
break;
110110
}
111111
}

test/Concurrency/transfernonsendable.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,3 +1617,12 @@ extension FinalActor {
16171617
// expected-complete-warning @-2 {{passing argument of non-sendable type 'NonSendableKlass' into actor-isolated context may introduce data races}}
16181618
}
16191619
}
1620+
1621+
actor DictionaryActorTest {
1622+
var data: [Int: Int] = [:]
1623+
1624+
// We used to crash on this due to isolation merging.
1625+
func doSomething(_ key: Int) {
1626+
assert(self.data[key] == 0)
1627+
}
1628+
}

0 commit comments

Comments
 (0)