@@ -405,6 +405,7 @@ class ApplyClassifier {
405
405
// But if the expression didn't type-check, suppress diagnostics.
406
406
if (!E->getType () || E->getType ()->hasError ())
407
407
return Classification::forInvalidCode ();
408
+
408
409
auto type = E->getFn ()->getType ();
409
410
if (!type) return Classification::forInvalidCode ();
410
411
auto fnType = type->getAs <AnyFunctionType>();
@@ -673,11 +674,18 @@ class ApplyClassifier {
673
674
return classifyShuffleRethrowsArgument (shuffle, paramTupleType);
674
675
}
675
676
676
- // Otherwise, we're passing an opaque tuple expression, and we
677
- // should treat it as contributing to 'rethrows' if the original
678
- // parameter type included a throwing function type.
679
- return classifyArgumentByType (paramType,
677
+ int scalarElt = paramTupleType->getElementForScalarInit ();
678
+ if (scalarElt < 0 ||
679
+ !paramTupleType->getElementType (scalarElt)->isEqual (arg->getType ())) {
680
+ // Otherwise, we're passing an opaque tuple expression, and we
681
+ // should treat it as contributing to 'rethrows' if the original
682
+ // parameter type included a throwing function type.
683
+ return classifyArgumentByType (
684
+ paramType,
680
685
PotentialReason::forRethrowsArgument (arg));
686
+ }
687
+
688
+ paramType = paramTupleType->getElementType (scalarElt);
681
689
}
682
690
683
691
// Otherwise, if the original parameter type was not a throwing
0 commit comments