Skip to content

Commit 9358f2f

Browse files
committed
[ConstraintSystem] Allow type variables for pack expansion patterns to bind
to noescape.
1 parent 8862b1b commit 9358f2f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

lib/Sema/CSGen.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3057,6 +3057,7 @@ namespace {
30573057
CS.getConstraintLocator(expr, ConstraintLocator::PackExpansionPattern);
30583058
auto patternTy = CS.createTypeVariable(patternLoc,
30593059
TVO_CanBindToPack |
3060+
TVO_CanBindToNoEscape |
30603061
TVO_CanBindToHole);
30613062
auto elementResultType = CS.getType(expr->getPatternExpr());
30623063
CS.addConstraint(ConstraintKind::PackElementOf, elementResultType,

test/Constraints/pack-expansion-expressions.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,9 @@ func test_pack_expansion_materialization_from_lvalue_base() {
196196
}
197197
}
198198
}
199+
200+
func takesFunctionPack<each T, R>(functions: repeat ((each T) -> R)) {}
201+
202+
func forwardFunctionPack<each T>(functions: repeat (each T) -> Bool) {
203+
takesFunctionPack(functions: repeat each functions)
204+
}

0 commit comments

Comments
 (0)