@@ -2273,9 +2273,8 @@ bool GenericSignatureBuilder::addGenericParameterRequirements(
2273
2273
auto PA = Impl->PotentialArchetypes [Key.findIndexIn (Impl->GenericParams )];
2274
2274
2275
2275
// Add the requirements from the declaration.
2276
- llvm::SmallPtrSet<ProtocolDecl *, 8 > visited;
2277
2276
return isErrorResult (
2278
- addInheritedRequirements (GenericParam, PA, nullptr , visited,
2277
+ addInheritedRequirements (GenericParam, PA, nullptr ,
2279
2278
GenericParam->getModuleContext ()));
2280
2279
}
2281
2280
@@ -2293,14 +2292,6 @@ void GenericSignatureBuilder::addGenericParameter(GenericTypeParamType *GenericP
2293
2292
Impl->PotentialArchetypes .push_back (PA);
2294
2293
}
2295
2294
2296
- ConstraintResult GenericSignatureBuilder::addConformanceRequirement (
2297
- PotentialArchetype *PAT,
2298
- ProtocolDecl *Proto,
2299
- const RequirementSource *Source) {
2300
- llvm::SmallPtrSet<ProtocolDecl *, 8 > Visited;
2301
- return addConformanceRequirement (PAT, Proto, Source, Visited);
2302
- }
2303
-
2304
2295
// / Visit all of the types that show up in the list of inherited
2305
2296
// / types.
2306
2297
static ConstraintResult visitInherited (
@@ -2349,8 +2340,7 @@ static ConstraintResult visitInherited(
2349
2340
ConstraintResult GenericSignatureBuilder::addConformanceRequirement (
2350
2341
PotentialArchetype *PAT,
2351
2342
ProtocolDecl *Proto,
2352
- const RequirementSource *Source,
2353
- llvm::SmallPtrSetImpl<ProtocolDecl *> &Visited) {
2343
+ const RequirementSource *Source) {
2354
2344
// Add the requirement, if we haven't done so already.
2355
2345
if (!PAT->addConformance (Proto, Source, *this ))
2356
2346
return ConstraintResult::Resolved;
@@ -2370,7 +2360,7 @@ ConstraintResult GenericSignatureBuilder::addConformanceRequirement(
2370
2360
/* inferred=*/ false );
2371
2361
for (auto req : reqSig->getRequirements ()) {
2372
2362
auto reqResult = addRequirement (req, innerSource, nullptr ,
2373
- &protocolSubMap, Visited );
2363
+ &protocolSubMap);
2374
2364
if (isErrorResult (reqResult)) return reqResult;
2375
2365
}
2376
2366
@@ -2384,7 +2374,7 @@ ConstraintResult GenericSignatureBuilder::addConformanceRequirement(
2384
2374
auto protoModule = Proto->getParentModule ();
2385
2375
2386
2376
auto inheritedReqResult =
2387
- addInheritedRequirements (Proto, PAT, Source, Visited, protoModule);
2377
+ addInheritedRequirements (Proto, PAT, Source, protoModule);
2388
2378
if (isErrorResult (inheritedReqResult))
2389
2379
return inheritedReqResult;
2390
2380
@@ -2403,8 +2393,7 @@ ConstraintResult GenericSignatureBuilder::addConformanceRequirement(
2403
2393
// Add requirements placed directly on this associated type.
2404
2394
Type assocType = DependentMemberType::get (concreteSelf, AssocType);
2405
2395
auto assocResult =
2406
- addInheritedRequirements (AssocType, assocType, Source, Visited,
2407
- protoModule);
2396
+ addInheritedRequirements (AssocType, assocType, Source, protoModule);
2408
2397
if (isErrorResult (assocResult))
2409
2398
return assocResult;
2410
2399
@@ -2581,13 +2570,7 @@ ConstraintResult GenericSignatureBuilder::addTypeRequirement(
2581
2570
UnresolvedType subject,
2582
2571
UnresolvedType constraint,
2583
2572
FloatingRequirementSource source,
2584
- UnresolvedHandlingKind unresolvedHandling,
2585
- llvm::SmallPtrSetImpl<ProtocolDecl *> *visited) {
2586
- // Make sure we always have a "visited" set to pass down.
2587
- SmallPtrSet<ProtocolDecl *, 4 > visitedSet;
2588
- if (!visited)
2589
- visited = &visitedSet;
2590
-
2573
+ UnresolvedHandlingKind unresolvedHandling) {
2591
2574
// Resolve the constraint.
2592
2575
auto resolvedConstraint = resolve (constraint, source);
2593
2576
if (!resolvedConstraint) {
@@ -2685,7 +2668,7 @@ ConstraintResult GenericSignatureBuilder::addTypeRequirement(
2685
2668
for (auto *proto : layout.getProtocols ()) {
2686
2669
auto *protoDecl = proto->getDecl ();
2687
2670
if (isErrorResult (addConformanceRequirement (subjectPA, protoDecl,
2688
- resolvedSource, *visited )))
2671
+ resolvedSource)))
2689
2672
anyErrors = true ;
2690
2673
}
2691
2674
@@ -3031,7 +3014,6 @@ ConstraintResult GenericSignatureBuilder::addInheritedRequirements(
3031
3014
TypeDecl *decl,
3032
3015
UnresolvedType type,
3033
3016
const RequirementSource *parentSource,
3034
- llvm::SmallPtrSetImpl<ProtocolDecl *> &visited,
3035
3017
ModuleDecl *inferForModule) {
3036
3018
if (isa<AssociatedTypeDecl>(decl) &&
3037
3019
decl->hasInterfaceType () &&
@@ -3096,8 +3078,7 @@ ConstraintResult GenericSignatureBuilder::addInheritedRequirements(
3096
3078
return addTypeRequirement (type, inheritedType,
3097
3079
getFloatingSource (typeRepr,
3098
3080
/* forInferred=*/ false ),
3099
- UnresolvedHandlingKind::GenerateConstraints,
3100
- &visited);
3081
+ UnresolvedHandlingKind::GenerateConstraints);
3101
3082
};
3102
3083
3103
3084
auto visitLayout = [&](LayoutConstraint layout, const TypeRepr *typeRepr) {
@@ -3206,21 +3187,11 @@ ConstraintResult GenericSignatureBuilder::addRequirement(
3206
3187
llvm_unreachable (" Unhandled requirement?" );
3207
3188
}
3208
3189
3209
- ConstraintResult GenericSignatureBuilder::addRequirement (
3210
- const Requirement &req,
3211
- FloatingRequirementSource source,
3212
- ModuleDecl *inferForModule,
3213
- const SubstitutionMap *subMap) {
3214
- llvm::SmallPtrSet<ProtocolDecl *, 8 > visited;
3215
- return addRequirement (req, source, inferForModule, subMap, visited);
3216
- }
3217
-
3218
3190
ConstraintResult GenericSignatureBuilder::addRequirement (
3219
3191
const Requirement &req,
3220
3192
FloatingRequirementSource source,
3221
3193
ModuleDecl *inferForModule,
3222
- const SubstitutionMap *subMap,
3223
- llvm::SmallPtrSetImpl<ProtocolDecl *> &Visited) {
3194
+ const SubstitutionMap *subMap) {
3224
3195
auto subst = [&](Type t) {
3225
3196
if (subMap)
3226
3197
return t.subst (*subMap);
@@ -3245,8 +3216,7 @@ ConstraintResult GenericSignatureBuilder::addRequirement(
3245
3216
}
3246
3217
3247
3218
return addTypeRequirement (firstType, secondType, source,
3248
- UnresolvedHandlingKind::GenerateConstraints,
3249
- &Visited);
3219
+ UnresolvedHandlingKind::GenerateConstraints);
3250
3220
}
3251
3221
3252
3222
case RequirementKind::Layout: {
0 commit comments