Skip to content

Commit dfa1fe5

Browse files
authored
Merge pull request #59555 from milseman/regex_capture_decoding
[5.7] [Sema] Update regex capture decoding
2 parents 6142c3c + 3f6b6e8 commit dfa1fe5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/Sema/CSGen.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,7 @@ namespace {
13011301
ctx.Id_Regex.str());
13021302
return Type();
13031303
}
1304-
SmallVector<TupleTypeElt, 4> matchElements {ctx.getSubstringType()};
1304+
SmallVector<TupleTypeElt, 4> matchElements;
13051305
if (decodeRegexCaptureTypes(ctx,
13061306
E->getSerializedCaptureStructure(),
13071307
/*atomType*/ ctx.getSubstringType(),
@@ -1310,6 +1310,7 @@ namespace {
13101310
diag::regex_capture_types_failed_to_decode);
13111311
return Type();
13121312
}
1313+
assert(!matchElements.empty() && "Should have decoded at least an atom");
13131314
if (matchElements.size() == 1)
13141315
return BoundGenericStructType::get(
13151316
regexDecl, Type(), matchElements.front().getType());

0 commit comments

Comments
 (0)