@@ -1110,6 +1110,61 @@ Type TypeBase::stripConcurrency(bool recurse, bool dropGlobalActor) {
1110
1110
return Type (this );
1111
1111
}
1112
1112
1113
+ if (auto *BGT = getAs<BoundGenericType>()) {
1114
+ if (!recurse)
1115
+ return Type (this );
1116
+
1117
+ bool anyChanged = false ;
1118
+ SmallVector<Type, 2 > genericArgs;
1119
+ llvm::transform (BGT->getGenericArgs (), std::back_inserter (genericArgs),
1120
+ [&](Type argTy) {
1121
+ auto newArgTy =
1122
+ argTy->stripConcurrency (recurse, dropGlobalActor);
1123
+ anyChanged |= !newArgTy->isEqual (argTy);
1124
+ return newArgTy;
1125
+ });
1126
+
1127
+ return anyChanged ? BoundGenericType::get (BGT->getDecl (), BGT->getParent (),
1128
+ genericArgs)
1129
+ : Type (this );
1130
+ }
1131
+
1132
+ if (auto *tuple = getAs<TupleType>()) {
1133
+ if (!recurse)
1134
+ return Type (this );
1135
+
1136
+ bool anyChanged = false ;
1137
+ SmallVector<TupleTypeElt, 2 > elts;
1138
+ llvm::transform (
1139
+ tuple->getElements (), std::back_inserter (elts), [&](const auto &elt) {
1140
+ auto eltTy = elt.getType ();
1141
+ auto strippedTy = eltTy->stripConcurrency (recurse, dropGlobalActor);
1142
+ anyChanged |= !strippedTy->isEqual (eltTy);
1143
+ return elt.getWithType (strippedTy);
1144
+ });
1145
+
1146
+ return anyChanged ? TupleType::get (elts, getASTContext ()) : Type (this );
1147
+ }
1148
+
1149
+ if (auto *arrayTy = dyn_cast<ArraySliceType>(this )) {
1150
+ auto newBaseTy =
1151
+ arrayTy->getBaseType ()->stripConcurrency (recurse, dropGlobalActor);
1152
+ return newBaseTy->isEqual (arrayTy->getBaseType ())
1153
+ ? Type (this )
1154
+ : ArraySliceType::get (newBaseTy);
1155
+ }
1156
+
1157
+ if (auto *dictTy = dyn_cast<DictionaryType>(this )) {
1158
+ auto keyTy = dictTy->getKeyType ();
1159
+ auto strippedKeyTy = keyTy->stripConcurrency (recurse, dropGlobalActor);
1160
+ auto valueTy = dictTy->getValueType ();
1161
+ auto strippedValueTy = valueTy->stripConcurrency (recurse, dropGlobalActor);
1162
+
1163
+ return keyTy->isEqual (strippedKeyTy) && valueTy->isEqual (strippedValueTy)
1164
+ ? Type (this )
1165
+ : DictionaryType::get (strippedKeyTy, strippedValueTy);
1166
+ }
1167
+
1113
1168
return Type (this );
1114
1169
}
1115
1170
0 commit comments