Skip to content

Commit f2287b9

Browse files
committed
Enable SIL verification for on-stack partial_apply ownership.
1 parent 61c12e4 commit f2287b9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/SIL/Verifier/SILVerifier.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,12 +1956,16 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
19561956
unsigned appliedArgStartIdx =
19571957
substConv.getNumSILArguments() - PAI->getNumArguments();
19581958
for (auto p : llvm::enumerate(PAI->getArguments())) {
1959+
unsigned argIdx = appliedArgStartIdx + p.index();
19591960
requireSameType(
19601961
p.value()->getType(),
1961-
substConv.getSILArgumentType(appliedArgStartIdx + p.index(),
1962-
F.getTypeExpansionContext()),
1962+
substConv.getSILArgumentType(argIdx, F.getTypeExpansionContext()),
19631963
"applied argument types do not match suffix of function type's "
19641964
"inputs");
1965+
if (PAI->isOnStack()) {
1966+
require(!substConv.getSILArgumentConvention(argIdx).isOwnedConvention(),
1967+
"on-stack closures do not support owned arguments");
1968+
}
19651969
}
19661970

19671971
// The arguments to the result function type must match the prefix of the

0 commit comments

Comments
 (0)