@@ -870,20 +870,23 @@ namespace {
870
870
unsigned typeParamCount = imported->getGenericParams ()->size ();
871
871
auto typeArgs = type->getObjectType ()->getTypeArgs ();
872
872
assert (typeArgs.empty () || typeArgs.size () == typeParamCount);
873
- llvm::SmallVector<Type, 2 > importedTypeArgs;
874
- for (unsigned i = 0 ; i < typeParamCount; i++) {
875
- Type importedTypeArg;
876
- auto typeParam = imported->getGenericParams ()->getParams ()[i];
877
- if (!typeArgs.empty ()) {
878
- auto subresult = Visit (typeArgs[i]);
879
- if (!subresult) {
873
+ SmallVector<Type, 2 > importedTypeArgs;
874
+ importedTypeArgs.reserve (typeParamCount);
875
+ if (!typeArgs.empty ()) {
876
+ for (auto typeArg : typeArgs) {
877
+ Type importedTypeArg = Visit (typeArg).AbstractType ;
878
+ if (!importedTypeArg)
880
879
return nullptr ;
880
+ importedTypeArgs.push_back (importedTypeArg);
881
+ }
882
+ } else {
883
+ for (auto typeParam : imported->getGenericParams ()->getParams ()) {
884
+ if (typeParam->getSuperclass () &&
885
+ typeParam->getConformingProtocols ().empty ()) {
886
+ importedTypeArgs.push_back (typeParam->getSuperclass ());
887
+ continue ;
881
888
}
882
- importedTypeArg = subresult.AbstractType ;
883
- } else if (typeParam->getSuperclass () &&
884
- typeParam->getConformingProtocols ().empty ()) {
885
- importedTypeArg = typeParam->getSuperclass ();
886
- } else {
889
+
887
890
SmallVector<Type, 4 > memberTypes;
888
891
889
892
if (auto superclassType = typeParam->getSuperclass ())
@@ -896,11 +899,11 @@ namespace {
896
899
if (memberTypes.empty ())
897
900
hasExplicitAnyObject = true ;
898
901
899
- importedTypeArg = ProtocolCompositionType::get (
902
+ Type importedTypeArg = ProtocolCompositionType::get (
900
903
Impl.SwiftContext , memberTypes,
901
904
hasExplicitAnyObject);
905
+ importedTypeArgs.push_back (importedTypeArg);
902
906
}
903
- importedTypeArgs.push_back (importedTypeArg);
904
907
}
905
908
assert (importedTypeArgs.size () == typeParamCount);
906
909
importedType = BoundGenericClassType::get (
0 commit comments