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 {
3078
3078
if (auto *elementExpr = getAsExpr<PackElementExpr>(pack)) {
3079
3079
packType = CS.getType (elementExpr->getPackRefExpr ());
3080
3080
} 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
+
3081
3087
packType = CS.getType (elementType->getPackType ());
3082
3088
} else {
3083
3089
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
70
70
71
71
_ = Array < each T > ( ) // expected-error {{pack reference 'T' can only appear in pack expansion or generic requirement}}
72
72
_ = 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}}
73
74
}
74
75
75
76
func 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