File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -3078,6 +3078,12 @@ namespace {
30783078 if (auto *elementExpr = getAsExpr<PackElementExpr>(pack)) {
30793079 packType = CS.getType (elementExpr->getPackRefExpr ());
30803080 } else if (auto *elementType = getAsTypeRepr<PackElementTypeRepr>(pack)) {
3081+ // OpenPackElementType sets types for 'each T' type reprs in
3082+ // expressions. Some invalid code won't make it there, and
3083+ // the constraint system won't have recorded a type.
3084+ if (!CS.hasType (elementType->getPackType ()))
3085+ return Type ();
3086+
30813087 packType = CS.getType (elementType->getPackType ());
30823088 } else {
30833089 llvm_unreachable (" unsupported pack reference ASTNode" );
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ func typeReprPacks<each T>(_ t: repeat each T) where each T: ExpressibleByIntege
7070
7171 _ = Array < each T > ( ) // expected-error {{pack reference 'T' can only appear in pack expansion or generic requirement}}
7272 _ = 1 as each T // expected-error {{pack reference 'T' can only appear in pack expansion or generic requirement}}
73+ repeat Invalid < String , each T > ( " " ) // expected-error {{cannot find 'Invalid' in scope}}
7374}
7475
7576func sameShapeDiagnostics< each T , each U > ( t: repeat each T , u: repeat each U ) {
You can’t perform that action at this time.
0 commit comments