@@ -855,21 +855,7 @@ Type ConstraintSystem::openUnboundGenericType(GenericTypeDecl *decl,
855
855
result = DC->mapTypeIntoContext (result);
856
856
}
857
857
858
- return result.transform ([&](Type type) -> Type {
859
- // Although generic parameters are declared with just `each`
860
- // their interface types introduce a pack expansion which
861
- // means that the solver has to extact generic argument type
862
- // variable from Pack{repeat ...} and drop that structure to
863
- // make sure that generic argument gets inferred to a pack type.
864
- if (auto *packTy = type->getAs <PackType>()) {
865
- assert (packTy->getNumElements () == 1 );
866
- auto *expansion = packTy->getElementType (0 )->castTo <PackExpansionType>();
867
- auto *typeVar = expansion->getPatternType ()->castTo <TypeVariableType>();
868
- assert (typeVar->getImpl ().getGenericParameter () &&
869
- typeVar->getImpl ().canBindToPack ());
870
- return typeVar;
871
- }
872
-
858
+ return result.transform ([&](Type type) {
873
859
if (auto *expansion = dyn_cast<PackExpansionType>(type.getPointer ()))
874
860
return openPackExpansionType (expansion, replacements, locator);
875
861
return type;
@@ -1022,15 +1008,6 @@ Type ConstraintSystem::openType(Type type, OpenedTypeMap &replacements,
1022
1008
}
1023
1009
}
1024
1010
1025
- // While opening variadic generic types that appear in other types
1026
- // we need to extract generic parameter from Pack{repeat ...} structure
1027
- // that gets introduced by the interface type, see
1028
- // \c openUnboundGenericType for more details.
1029
- if (auto *packTy = type->getAs <PackType>()) {
1030
- if (auto expansion = packTy->unwrapSingletonPackExpansion ())
1031
- type = expansion->getPatternType ();
1032
- }
1033
-
1034
1011
if (auto *expansion = type->getAs <PackExpansionType>()) {
1035
1012
return openPackExpansionType (expansion, replacements, locator);
1036
1013
}
0 commit comments