Skip to content

Commit 9a3ba0e

Browse files
committed
Assert immediately if someone tries to build a SILFunctionType with
multiple isolated parameters.
1 parent 6f9aef4 commit 9a3ba0e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/AST/ASTContext.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5350,8 +5350,13 @@ SILFunctionType::SILFunctionType(
53505350
"Cannot return an @noescape function type");
53515351
}
53525352
}
5353+
bool hasIsolatedParameter = false; (void) hasIsolatedParameter;
53535354
for (auto param : getParameters()) {
5354-
(void)param;
5355+
if (param.hasOption(SILParameterInfo::Isolated)) {
5356+
assert(!hasIsolatedParameter &&
5357+
"building SIL function type with multiple isolated parameters");
5358+
hasIsolatedParameter = true;
5359+
}
53555360
assert(!isa<PackExpansionType>(param.getInterfaceType()) &&
53565361
"Cannot have a pack expansion directly as a parameter");
53575362
assert(param.isPack() == isa<SILPackType>(param.getInterfaceType()) &&

0 commit comments

Comments
 (0)