Skip to content

Commit 35fcc37

Browse files
authored
Merge pull request #65134 from hborla/parameter-pack-revision
[SE-0393] Require the `repeat` keyword for generic requirement expansions.
2 parents ceb48be + 234b5dc commit 35fcc37

24 files changed

+113
-71
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5387,9 +5387,8 @@ ERROR(invalid_expansion_argument,none,
53875387
ERROR(expansion_not_variadic,none,
53885388
"pack expansion %0 must contain at least one pack reference", (Type))
53895389
ERROR(pack_reference_outside_expansion,none,
5390-
"pack reference %0 can only appear in pack expansion "
5391-
"%select{or generic requirement|}1",
5392-
(Type, /*inExpression*/ bool))
5390+
"pack reference %0 can only appear in pack expansion ",
5391+
(Type))
53935392
ERROR(each_non_pack,none,
53945393
"'each' cannot be applied to non-pack type %0",
53955394
(Type))

include/swift/AST/GenericParamList.h

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class RequirementRepr {
5858
SourceLoc SeparatorLoc;
5959
RequirementReprKind Kind : 2;
6060
bool Invalid : 1;
61+
bool IsExpansionPattern : 1;
6162
TypeRepr *FirstType;
6263

6364
/// The second element represents the right-hand side of the constraint.
@@ -72,13 +73,17 @@ class RequirementRepr {
7273
StringRef AsWrittenString;
7374

7475
RequirementRepr(SourceLoc SeparatorLoc, RequirementReprKind Kind,
75-
TypeRepr *FirstType, TypeRepr *SecondType)
76+
TypeRepr *FirstType, TypeRepr *SecondType,
77+
bool IsExpansionPattern)
7678
: SeparatorLoc(SeparatorLoc), Kind(Kind), Invalid(false),
79+
IsExpansionPattern(IsExpansionPattern),
7780
FirstType(FirstType), SecondType(SecondType) { }
7881

7982
RequirementRepr(SourceLoc SeparatorLoc, RequirementReprKind Kind,
80-
TypeRepr *FirstType, LayoutConstraintLoc SecondLayout)
83+
TypeRepr *FirstType, LayoutConstraintLoc SecondLayout,
84+
bool IsExpansionPattern)
8185
: SeparatorLoc(SeparatorLoc), Kind(Kind), Invalid(false),
86+
IsExpansionPattern(IsExpansionPattern),
8287
FirstType(FirstType), SecondLayout(SecondLayout) { }
8388

8489
public:
@@ -92,8 +97,10 @@ class RequirementRepr {
9297
/// subject must conform, or superclass from which the subject must inherit.
9398
static RequirementRepr getTypeConstraint(TypeRepr *Subject,
9499
SourceLoc ColonLoc,
95-
TypeRepr *Constraint) {
96-
return { ColonLoc, RequirementReprKind::TypeConstraint, Subject, Constraint };
100+
TypeRepr *Constraint,
101+
bool IsExpansionPattern) {
102+
return { ColonLoc, RequirementReprKind::TypeConstraint, Subject, Constraint,
103+
IsExpansionPattern };
97104
}
98105

99106
/// Construct a new same-type requirement.
@@ -104,8 +111,10 @@ class RequirementRepr {
104111
/// \param SecondType The second type.
105112
static RequirementRepr getSameType(TypeRepr *FirstType,
106113
SourceLoc EqualLoc,
107-
TypeRepr *SecondType) {
108-
return { EqualLoc, RequirementReprKind::SameType, FirstType, SecondType };
114+
TypeRepr *SecondType,
115+
bool IsExpansionPattern) {
116+
return { EqualLoc, RequirementReprKind::SameType, FirstType, SecondType,
117+
IsExpansionPattern };
109118
}
110119

111120
/// Construct a new layout-constraint requirement.
@@ -118,9 +127,10 @@ class RequirementRepr {
118127
/// subject must conform.
119128
static RequirementRepr getLayoutConstraint(TypeRepr *Subject,
120129
SourceLoc ColonLoc,
121-
LayoutConstraintLoc Layout) {
130+
LayoutConstraintLoc Layout,
131+
bool IsExpansionPattern) {
122132
return {ColonLoc, RequirementReprKind::LayoutConstraint, Subject,
123-
Layout};
133+
Layout, IsExpansionPattern};
124134
}
125135

126136
/// Determine the kind of requirement
@@ -129,6 +139,12 @@ class RequirementRepr {
129139
/// Determine whether this requirement is invalid.
130140
bool isInvalid() const { return Invalid; }
131141

142+
/// Whether this requirement repr is the pattern of a requirement
143+
/// expansion, e.g. `repeat G<each T> == (each U).A`
144+
bool isExpansionPattern() const {
145+
return IsExpansionPattern;
146+
}
147+
132148
/// Mark this requirement invalid.
133149
void setInvalid() { Invalid = true; }
134150

lib/AST/ASTPrinter.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,16 +1842,23 @@ void PrintAST::printRequirement(const Requirement &req) {
18421842
Printer << ")) : Any";
18431843
return;
18441844
case RequirementKind::Layout:
1845+
if (req.getFirstType()->hasParameterPack())
1846+
Printer << "repeat ";
18451847
printTransformedType(req.getFirstType());
18461848
Printer << " : ";
18471849
req.getLayoutConstraint()->print(Printer, Options);
18481850
return;
18491851
case RequirementKind::Conformance:
18501852
case RequirementKind::Superclass:
1853+
if (req.getFirstType()->hasParameterPack())
1854+
Printer << "repeat ";
18511855
printTransformedType(req.getFirstType());
18521856
Printer << " : ";
18531857
break;
18541858
case RequirementKind::SameType:
1859+
if (req.getFirstType()->hasParameterPack() ||
1860+
req.getSecondType()->hasParameterPack())
1861+
Printer << "repeat ";
18551862
printTransformedType(req.getFirstType());
18561863
Printer << " == ";
18571864
break;

lib/AST/CASTBridging.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,12 +562,12 @@ void *GenericParamList_create(void *ctx, void *lAngleLoc,
562562
case BridgedRequirementReprKindTypeConstraint:
563563
requirements.push_back(RequirementRepr::getTypeConstraint(
564564
(TypeRepr *)req.FirstType, getSourceLocFromPointer(req.SeparatorLoc),
565-
(TypeRepr *)req.SecondType));
565+
(TypeRepr *)req.SecondType, /*isExpansionPattern*/false));
566566
break;
567567
case BridgedRequirementReprKindSameType:
568568
requirements.push_back(RequirementRepr::getSameType(
569569
(TypeRepr *)req.FirstType, getSourceLocFromPointer(req.SeparatorLoc),
570-
(TypeRepr *)req.SecondType));
570+
(TypeRepr *)req.SecondType, /*isExpansionPattern*/false));
571571
break;
572572
case BridgedRequirementReprKindLayoutConstraint:
573573
llvm_unreachable("cannot handle layout constraints!");

lib/Parse/ParseGeneric.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,13 @@ ParserStatus Parser::parseGenericWhereClause(
288288
break;
289289
}
290290

291+
// Parse the 'repeat' keyword for requirement expansions.
292+
bool isRequirementExpansion = false;
293+
if (Tok.is(tok::kw_repeat)) {
294+
consumeToken();
295+
isRequirementExpansion = true;
296+
}
297+
291298
// Parse the leading type. It doesn't necessarily have to be just a type
292299
// identifier if we're dealing with a same-type constraint.
293300
ParserResult<TypeRepr> FirstType = parseType();
@@ -326,7 +333,8 @@ ParserStatus Parser::parseGenericWhereClause(
326333
// Add the layout requirement.
327334
Requirements.push_back(RequirementRepr::getLayoutConstraint(
328335
FirstType.get(), ColonLoc,
329-
LayoutConstraintLoc(Layout, LayoutLoc)));
336+
LayoutConstraintLoc(Layout, LayoutLoc),
337+
isRequirementExpansion));
330338
}
331339
} else {
332340
// Parse the protocol or composition.
@@ -337,7 +345,7 @@ ParserStatus Parser::parseGenericWhereClause(
337345

338346
// Add the requirement.
339347
Requirements.push_back(RequirementRepr::getTypeConstraint(
340-
FirstType.get(), ColonLoc, Protocol.get()));
348+
FirstType.get(), ColonLoc, Protocol.get(), isRequirementExpansion));
341349
}
342350
} else if ((Tok.isAnyOperator() && Tok.getText() == "==") ||
343351
Tok.is(tok::equal)) {
@@ -367,15 +375,18 @@ ParserStatus Parser::parseGenericWhereClause(
367375
// completion token in the TypeRepr.
368376
Requirements.push_back(RequirementRepr::getTypeConstraint(
369377
FirstType.get(), EqualLoc,
370-
new (Context) ErrorTypeRepr(SecondType.get()->getLoc())));
378+
new (Context) ErrorTypeRepr(SecondType.get()->getLoc()),
379+
isRequirementExpansion));
371380
} else {
372381
Requirements.push_back(RequirementRepr::getSameType(
373-
FirstType.get(), EqualLoc, SecondType.get()));
382+
FirstType.get(), EqualLoc, SecondType.get(),
383+
isRequirementExpansion));
374384
}
375385
} else if (FirstType.hasCodeCompletion()) {
376386
// Recover by adding dummy constraint.
377387
Requirements.push_back(RequirementRepr::getTypeConstraint(
378-
FirstType.get(), PreviousLoc, new (Context) ErrorTypeRepr(PreviousLoc)));
388+
FirstType.get(), PreviousLoc, new (Context) ErrorTypeRepr(PreviousLoc),
389+
isRequirementExpansion));
379390
} else {
380391
diagnose(Tok, diag::expected_requirement_delim);
381392
Status.setIsParseError();

lib/Sema/CSDiagnostics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6043,7 +6043,7 @@ bool InvalidPackElement::diagnoseAsError() {
60436043

60446044
bool InvalidPackReference::diagnoseAsError() {
60456045
emitDiagnostic(diag::pack_reference_outside_expansion,
6046-
packType, /*inExpression*/true);
6046+
packType);
60476047
return true;
60486048
}
60496049

lib/Sema/TypeCheckGeneric.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,8 @@ RequirementRequest::evaluate(Evaluator &evaluator,
10281028
context = TypeResolverContext::GenericRequirement;
10291029
}
10301030
auto options = TypeResolutionOptions(context);
1031-
options |= TypeResolutionFlags::AllowPackReferences;
1031+
if (reqRepr.isExpansionPattern())
1032+
options |= TypeResolutionFlags::AllowPackReferences;
10321033
if (owner.dc->isInSpecializeExtensionContext())
10331034
options |= TypeResolutionFlags::AllowUsableFromInline;
10341035
Optional<TypeResolution> resolution;

lib/Sema/TypeCheckType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4637,7 +4637,7 @@ NeverNullType TypeResolver::resolvePackElement(PackElementTypeRepr *repr,
46374637
if (!options.contains(TypeResolutionFlags::AllowPackReferences)) {
46384638
ctx.Diags.diagnose(repr->getLoc(),
46394639
diag::pack_reference_outside_expansion,
4640-
packReference, /*inExpression*/false);
4640+
packReference);
46414641
return ErrorType::get(ctx);
46424642
}
46434643

test/Constraints/pack-expansion-expressions.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ protocol P {
5252
func f(_ self: Self) -> Self
5353
}
5454

55-
func outerArchetype<each T, U>(t: repeat each T, u: U) where each T: P {
55+
func outerArchetype<each T, U>(t: repeat each T, u: U) where repeat each T: P {
5656
let _: (repeat (each T.A, U)) = (repeat ((each t).value, u))
5757
}
5858

59-
func sameElement<each T, U>(t: repeat each T, u: U) where each T: P, each T == U {
59+
func sameElement<each T, U>(t: repeat each T, u: U) where repeat each T: P, repeat each T == U {
6060
// expected-error@-1{{same-element requirements are not yet supported}}
6161

6262
// FIXME: Opened element archetypes in diagnostics
@@ -65,15 +65,15 @@ func sameElement<each T, U>(t: repeat each T, u: U) where each T: P, each T == U
6565
}
6666

6767
func forEachEach<each C, U>(c: repeat each C, function: (U) -> Void)
68-
where each C: Collection, each C.Element == U {
68+
where repeat each C: Collection, repeat (each C).Element == U {
6969
// expected-error@-1{{same-element requirements are not yet supported}}
7070

7171
// FIXME: Opened element archetypes in diagnostics
7272
_ = (repeat (each c).forEach(function))
7373
// expected-error@-1 {{cannot convert value of type '(U) -> Void' to expected argument type '(τ_1_0.Element) throws -> Void'}}
7474
}
7575

76-
func typeReprPacks<each T>(_ t: repeat each T) where each T: ExpressibleByIntegerLiteral {
76+
func typeReprPacks<each T: ExpressibleByIntegerLiteral>(_ t: repeat each T) {
7777
_ = (repeat Array<each T>())
7878
_ = (repeat 1 as each T)
7979

test/Constraints/pack_expansion_types.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ func patternInstantiationConcreteInvalid() {
264264
let _: (Array<Int>, Set<String>) = patternInstantiationTupleTest1() // expected-error {{type of expression is ambiguous without more context}}
265265
}
266266

267-
func patternInstantiationGenericValid<each T, each U>(t: repeat each T, u: repeat each U) where (repeat (each T, each U)): Any, each T: Hashable {
267+
func patternInstantiationGenericValid<each T, each U>(t: repeat each T, u: repeat each U)
268+
where (repeat (each T, each U)): Any, repeat each T: Hashable {
268269
let _: (repeat Array<each T>) = patternInstantiationTupleTest1()
269270
let _: (repeat Array<each T>, Array<String>) = patternInstantiationTupleTest1()
270271
let _: (Array<String>, repeat Array<each T>) = patternInstantiationTupleTest1()
@@ -286,7 +287,7 @@ func patternInstantiationGenericValid<each T, each U>(t: repeat each T, u: repea
286287
let _: (Dictionary<Int, String>, repeat Dictionary<each T, each U>, Dictionary<Double, Character>) -> () = patternInstantiationFunctionTest2()
287288
}
288289

289-
func patternInstantiationGenericInvalid<each T>(t: repeat each T) where each T: Hashable {
290+
func patternInstantiationGenericInvalid<each T: Hashable>(t: repeat each T) {
290291
let _: (repeat Set<each T>) = patternInstantiationTupleTest1() // expected-error {{cannot convert value of type '(repeat Array<each T>)' to specified type '(repeat Set<each T>)}}
291292
// expected-error@-1 {{generic parameter 'T' could not be inferred}}
292293

test/Constraints/variadic_generic_constraints.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ takesAnyObject(C(), S(), C()) // expected-error {{type of expression is ambiguo
4747

4848
// Same-type requirements
4949

50-
func takesParallelSequences<each T, each U>(t: repeat each T, u: repeat each U) where each T: Sequence, each U: Sequence, each T.Element == each U.Element {}
51-
// expected-note@-1 {{where 'T.Element' = 'String', 'U.Element' = 'Int'}}
52-
50+
// expected-note@+1 {{where 'T.Element' = 'String', 'U.Element' = 'Int'}}
51+
func takesParallelSequences<each T, each U>(t: repeat each T, u: repeat each U)
52+
where repeat each T: Sequence,
53+
repeat each U: Sequence,
54+
repeat (each T).Element == (each U).Element {}
5355
takesParallelSequences() // ok
5456
takesParallelSequences(t: Array<Int>(), u: Set<Int>()) // ok
5557
takesParallelSequences(t: Array<String>(), Set<Int>(), u: Set<String>(), Array<Int>()) // ok

test/Constraints/variadic_generic_functions.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
// REQUIRES: asserts
44

55
func debugPrint<each T>(_ items: repeat each T)
6-
where each T: CustomDebugStringConvertible
6+
where repeat each T: CustomDebugStringConvertible
77
{
88
/*for (item: T) in items {
99
stdout.write(item.debugDescription)
1010
}*/
1111
}
1212

1313
func max<each T>(_ values: repeat each T) -> (repeat each T)?
14-
where each T: Comparable
14+
where repeat each T: Comparable
1515
{
1616
return nil
1717
}

test/Frontend/experimental_feature.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ let x = BOOM
1111

1212
// Use variadic generics
1313
func debugPrint<each T>(_ items: repeat each T)
14-
where each T: CustomDebugStringConvertible
14+
where repeat each T: CustomDebugStringConvertible
1515
{
1616
}

test/Generics/pack-shape-requirements.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ func inferSameShape<each T, each U>(ts t: repeat each T, us u: repeat each U) wh
1212
}
1313

1414
// CHECK-LABEL: desugarSameShape(ts:us:)
15-
// CHECK-NEXT: Generic signature: <each T, each U where T : P, (repeat (each T, each U)) : Any, U : P>
16-
func desugarSameShape<each T, each U>(ts t: repeat each T, us u: repeat each U) where each T: P, each U: P, (repeat (each T.A, each U.A)): Any {
17-
}
15+
// CHECK-NEXT: Generic signature: <each T, each U where repeat T : P, (repeat (each T, each U)) : Any, repeat U : P>
16+
func desugarSameShape<each T, each U>(ts t: repeat each T, us u: repeat each U)
17+
where repeat each T: P, repeat each U: P, (repeat (each T.A, each U.A)): Any {}
1818

1919
// CHECK-LABEL: multipleSameShape1(ts:us:vs:)
2020
// CHECK-NEXT: Generic signature: <each T, each U, each V where (repeat (each T, each U)) : Any, (repeat (each U, each V)) : Any>
@@ -49,14 +49,14 @@ func multipleSameShape6<each T, each U, each V>(ts t: repeat each T, us u: repea
4949
struct Ts<each T> {
5050
struct Us<each U> {
5151
// CHECK-LABEL: Ts.Us.packEquality()
52-
// CHECK-NEXT: Generic signature: <each T, each U where T == U>
53-
func packEquality() where each T == each U, (repeat (each T, each U)): Any {
52+
// CHECK-NEXT: Generic signature: <each T, each U where repeat T == U>
53+
func packEquality() where repeat each T == each U, (repeat (each T, each U)): Any {
5454
}
5555

5656
struct Vs<each V> {
5757
// CHECK-LABEL: Ts.Us.Vs.packEquality()
58-
// CHECK-NEXT: Generic signature: <each T, each U, each V where T == U, (repeat (each T, each V)) : Any>
59-
func packEquality() where each T == each U, (repeat (each U, each V)): Any {
58+
// CHECK-NEXT: Generic signature: <each T, each U, each V where repeat T == U, (repeat (each T, each V)) : Any>
59+
func packEquality() where repeat each T == each U, (repeat (each U, each V)): Any {
6060
}
6161
}
6262
}

test/Generics/tuple-conformances.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ protocol P {
1111
func f()
1212
}
1313

14-
extension Builtin.TheTupleType: P where each Elements: P {
14+
extension Builtin.TheTupleType: P where repeat each Elements: P {
1515
typealias A = (repeat each Elements.A)
1616
typealias B = Float
1717
func f() {}

test/Generics/variadic_generic_requirements.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ _ = Layout<Class, Subclass>.self // ok
2222
_ = Layout<Int, String>.self // expected-error {{'Layout' requires that 'Int' be a class type}}
2323

2424
struct Outer<each T: Sequence> {
25-
struct Inner<each U: Sequence> where each T.Element == each U.Element {}
25+
struct Inner<each U: Sequence> where repeat each T.Element == each U.Element {}
2626
// expected-note@-1 {{requirement specified as 'T.Element' == 'U.Element' [with each T = Array<Int>, Array<String>; each U = Set<String>, Set<Int>]}}
2727
// expected-note@-2 {{requirement specified as 'T.Element' == 'U.Element' [with each T = Array<Int>; each U = Set<Int>, Set<String>]}}
2828

@@ -36,4 +36,4 @@ _ = Outer<Array<Int>, Array<String>>.Inner<Set<String>, Set<Int>>.self // expec
3636
_ = Outer<Array<Int>>.Inner<Set<Int>, Set<String>>.self // expected-error {{'Outer<Array<Int>>.Inner' requires the types 'Pack{Int}' and 'Pack{Int, String}' be equivalent}}
3737

3838
_ = Outer<Array<Int>, Array<String>>.InnerShape<Set<String>, Set<Int>>.self // ok
39-
_ = Outer<Array<Int>>.InnerShape<Set<Int>, Set<String>>.self // expected-error {{'Outer<Array<Int>>.InnerShape' requires the type packs 'Pack{Array<Int>}' and 'Pack{Set<Int>, Set<String>}' have the same shape}}
39+
_ = Outer<Array<Int>>.InnerShape<Set<Int>, Set<String>>.self // expected-error {{'Outer<Array<Int>>.InnerShape' requires the type packs 'Pack{Array<Int>}' and 'Pack{Set<Int>, Set<String>}' have the same shape}}

test/IRGen/run_variadic_generics.sil

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ entry(%intIndex : $Builtin.Word):
626626
return %t : $()
627627
}
628628

629-
sil @unwrap_from_PA : $<each T_1 : PA where each T_1.A : P> (Builtin.Word) -> () {
629+
sil @unwrap_from_PA : $<each T_1 : PA where repeat each T_1.A : P> (Builtin.Word) -> () {
630630
entry(%intIndex : $Builtin.Word):
631631
%direct_access_from_parameter_with_conformance = function_ref @direct_access_from_parameter_with_conformance : $@convention(thin) <each T_1: P> (Builtin.Word) -> ()
632632
apply %direct_access_from_parameter_with_conformance<Pack{repeat GenFwdP<each T_1.A>}>(%intIndex) : $@convention(thin) <each T_1: P> (Builtin.Word) -> ()
@@ -637,7 +637,7 @@ entry(%intIndex : $Builtin.Word):
637637
sil @extract_associatedtype_with_conformance : $<each T_1 : P> (Builtin.Word) -> () {
638638
entry(%intIndex : $Builtin.Word):
639639
%innerIndex = dynamic_pack_index %intIndex of $Pack{repeat each T_1}
640-
%token = open_pack_element %innerIndex of <each U_1 : PA where each U_1.A : P> at <Pack{repeat GenAssocPA<GenFwdP<each T_1>>}>, shape $U_1, uuid "01234567-89AB-CDEF-0123-000000000005"
640+
%token = open_pack_element %innerIndex of <each U_1 : PA where repeat each U_1.A : P> at <Pack{repeat GenAssocPA<GenFwdP<each T_1>>}>, shape $U_1, uuid "01234567-89AB-CDEF-0123-000000000005"
641641
%metatype_1 = metatype $@thick (@pack_element("01234567-89AB-CDEF-0123-000000000005") U_1).Type
642642
%printGenericType = function_ref @printGenericType : $@convention(thin) <T> (@thick T.Type) -> ()
643643
apply %printGenericType<(@pack_element("01234567-89AB-CDEF-0123-000000000005") U_1)>(%metatype_1) : $@convention(thin) <T> (@thick T.Type) -> ()
@@ -653,7 +653,7 @@ sil @extract_associatedtype_with_conformance2 : $<each T_1 : P, Tee : P, each T_
653653
entry(%intIndex : $Builtin.Word):
654654
%innerIndex = dynamic_pack_index %intIndex of $Pack{repeat GenAssocPA<GenAssocPA<GenAssocPA<GenFwdP<each T_1>>>>, repeat GenAssocPA<GenAssocPA<GenAssocPA<GenFwdP<each T_1>>>>}
655655
%token = open_pack_element %innerIndex
656-
of <each U_1 : PA, Ewe : PA, each U_2 : PA where each U_1.A : PA, each U_1.A.A : PA, each U_1.A.A.A : P, Ewe.A : PA, Ewe.A.A : PA, Ewe.A.A.A : P, each U_2.A : PA, each U_2.A.A : PA, each U_2.A.A.A : P, (repeat (each U_1, each U_2)): Any>
656+
of <each U_1 : PA, Ewe : PA, each U_2 : PA where repeat each U_1.A : PA, repeat each U_1.A.A : PA, repeat each U_1.A.A.A : P, Ewe.A : PA, Ewe.A.A : PA, Ewe.A.A.A : P, repeat each U_2.A : PA, repeat each U_2.A.A : PA, repeat each U_2.A.A.A : P, (repeat (each U_1, each U_2)): Any>
657657
at <
658658
Pack{repeat GenAssocPA<GenAssocPA<GenAssocPA<GenFwdP<each T_1>>>>, repeat GenAssocPA<GenAssocPA<GenAssocPA<GenFwdP<each T_1>>>>},
659659
GenAssocPA<GenAssocPA<GenAssocPA<GenFwdP<Tee>>>>,

test/IRGen/variadic_generic_captures.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,6 @@ public func has_witness_table_pack<each T: Sequence>(t: repeat each T) -> () ->
8282
}
8383

8484
public func has_witness_table_pack2<each T: Sequence>(t: repeat each T) -> () -> ()
85-
where each T.Element: Sequence {
85+
where repeat each T.Element: Sequence {
8686
return { _ = (repeat (each T).Element.Element).self }
8787
}

0 commit comments

Comments
 (0)