Skip to content

Commit 5766b56

Browse files
committed
[RequirementMachine] Don't produced concrete type parameter diagnostics for
same-type requirements where one side is a parameter pack.
1 parent bdab953 commit 5766b56

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/AST/RequirementMachine/RequirementMachineRequests.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,13 @@ InferredGenericSignatureRequest::evaluate(
951951
continue;
952952

953953
if (reduced->isTypeParameter()) {
954+
// If one side is a parameter pack and the other is not, this is a
955+
// same-element requirement that cannot be expressed with only one
956+
// type parameter.
957+
if ((genericParam->isParameterPack() && !reduced->isParameterPack()) ||
958+
(!genericParam->isParameterPack() && reduced->isParameterPack()))
959+
continue;
960+
954961
ctx.Diags.diagnose(loc, diag::requires_generic_params_made_equal,
955962
genericParam, result->getSugaredType(reduced))
956963
.warnUntilSwiftVersion(6);

0 commit comments

Comments
 (0)