File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -3779,11 +3779,25 @@ struct TypeSimplifier {
3779
3779
if (auto tuple = dyn_cast<TupleType>(type.getPointer ())) {
3780
3780
if (tuple->getNumElements () == 1 ) {
3781
3781
auto element = tuple->getElement (0 );
3782
- auto elementType = element.getType ().transform (*this );
3782
+ auto elementType = element.getType ();
3783
+ auto resolvedType = elementType.transform (*this );
3784
+
3785
+ // If this is a single-element tuple with pack expansion
3786
+ // variable inside, let's unwrap it if pack is flattened.
3787
+ if (!element.hasName ()) {
3788
+ if (auto *typeVar = elementType->getAs <TypeVariableType>()) {
3789
+ if (typeVar->getImpl ().isPackExpansion () &&
3790
+ !resolvedType->isEqual (typeVar) &&
3791
+ !resolvedType->is <PackExpansionType>() &&
3792
+ !resolvedType->is <PackType>()) {
3793
+ return resolvedType;
3794
+ }
3795
+ }
3796
+ }
3783
3797
3784
3798
// Flatten single-element tuples containing type variables that cannot
3785
3799
// bind to packs.
3786
- auto typeVar = elementType ->getAs <TypeVariableType>();
3800
+ auto typeVar = resolvedType ->getAs <TypeVariableType>();
3787
3801
if (!element.hasName () && typeVar &&
3788
3802
!typeVar->getImpl ().canBindToPack () &&
3789
3803
!typeVar->getImpl ().isPackExpansion ()) {
You can’t perform that action at this time.
0 commit comments