@@ -65,6 +65,7 @@ namespace constraints {
65
65
class ConstraintSystem ;
66
66
class SyntacticElementTarget ;
67
67
struct PreparedOverload ;
68
+ struct PreparedOverloadBuilder ;
68
69
69
70
} // end namespace constraints
70
71
@@ -2954,7 +2955,7 @@ class ConstraintSystem {
2954
2955
// / Create a new type variable.
2955
2956
TypeVariableType *createTypeVariable (ConstraintLocator *locator,
2956
2957
unsigned options,
2957
- PreparedOverload *preparedOverload
2958
+ PreparedOverloadBuilder *preparedOverload
2958
2959
= nullptr );
2959
2960
2960
2961
// / Retrieve the set of active type variables.
@@ -3414,7 +3415,8 @@ class ConstraintSystem {
3414
3415
// / Update OpenedExistentials and record a change in the trail.
3415
3416
void recordOpenedExistentialType (ConstraintLocator *locator,
3416
3417
ExistentialArchetypeType *opened,
3417
- PreparedOverload *preparedOverload = nullptr );
3418
+ PreparedOverloadBuilder *preparedOverload
3419
+ = nullptr );
3418
3420
3419
3421
// / Retrieve the generic environment for the opened element of a given pack
3420
3422
// / expansion, or \c nullptr if no environment was recorded yet.
@@ -3622,7 +3624,7 @@ class ConstraintSystem {
3622
3624
// / Log and record the application of the fix. Return true iff any
3623
3625
// / subsequent solution would be worse than the best known solution.
3624
3626
bool recordFix (ConstraintFix *fix, unsigned impact = 1 ,
3625
- PreparedOverload *preparedOverload = nullptr );
3627
+ PreparedOverloadBuilder *preparedOverload = nullptr );
3626
3628
3627
3629
void recordPotentialHole (TypeVariableType *typeVar);
3628
3630
void recordAnyTypeVarAsPotentialHole (Type type);
@@ -3698,13 +3700,13 @@ class ConstraintSystem {
3698
3700
void addConstraint (ConstraintKind kind, Type first, Type second,
3699
3701
ConstraintLocatorBuilder locator,
3700
3702
bool isFavored = false ,
3701
- PreparedOverload *preparedOverload = nullptr );
3703
+ PreparedOverloadBuilder *preparedOverload = nullptr );
3702
3704
3703
3705
// / Add a requirement as a constraint to the constraint system.
3704
3706
void addConstraint (Requirement req, ConstraintLocatorBuilder locator,
3705
3707
bool isFavored,
3706
3708
bool prohibitNonisolatedConformance,
3707
- PreparedOverload *preparedOverload = nullptr );
3709
+ PreparedOverloadBuilder *preparedOverload = nullptr );
3708
3710
3709
3711
void addApplicationConstraint (
3710
3712
FunctionType *appliedFn, Type calleeType,
@@ -4319,7 +4321,7 @@ class ConstraintSystem {
4319
4321
Type openUnboundGenericType (GenericTypeDecl *decl, Type parentTy,
4320
4322
ConstraintLocatorBuilder locator,
4321
4323
bool isTypeResolution,
4322
- PreparedOverload *preparedOverload = nullptr );
4324
+ PreparedOverloadBuilder *preparedOverload = nullptr );
4323
4325
4324
4326
// / Replace placeholder types with fresh type variables, and unbound generic
4325
4327
// / types with bound generic types whose generic args are fresh type
@@ -4330,7 +4332,7 @@ class ConstraintSystem {
4330
4332
// / \returns The converted type.
4331
4333
Type replaceInferableTypesWithTypeVars (Type type,
4332
4334
ConstraintLocatorBuilder locator,
4333
- PreparedOverload *preparedOverload
4335
+ PreparedOverloadBuilder *preparedOverload
4334
4336
= nullptr );
4335
4337
4336
4338
// / "Open" the given type by replacing any occurrences of generic
@@ -4343,7 +4345,7 @@ class ConstraintSystem {
4343
4345
// / \returns The opened type, or \c type if there are no archetypes in it.
4344
4346
Type openType (Type type, ArrayRef<OpenedType> replacements,
4345
4347
ConstraintLocatorBuilder locator,
4346
- PreparedOverload *preparedOverload);
4348
+ PreparedOverloadBuilder *preparedOverload);
4347
4349
4348
4350
// / "Open" an opaque archetype type, similar to \c openType.
4349
4351
Type openOpaqueType (OpaqueTypeArchetypeType *type,
@@ -4360,12 +4362,12 @@ class ConstraintSystem {
4360
4362
Type openPackExpansionType (PackExpansionType *expansion,
4361
4363
ArrayRef<OpenedType> replacements,
4362
4364
ConstraintLocatorBuilder locator,
4363
- PreparedOverload *preparedOverload);
4365
+ PreparedOverloadBuilder *preparedOverload);
4364
4366
4365
4367
// / Update OpenedPackExpansionTypes and record a change in the trail.
4366
4368
void recordOpenedPackExpansionType (PackExpansionType *expansion,
4367
4369
TypeVariableType *expansionVar,
4368
- PreparedOverload *preparedOverload
4370
+ PreparedOverloadBuilder *preparedOverload
4369
4371
= nullptr );
4370
4372
4371
4373
// / Undo the above change.
@@ -4392,29 +4394,29 @@ class ConstraintSystem {
4392
4394
ConstraintLocatorBuilder locator,
4393
4395
SmallVectorImpl<OpenedType> &replacements,
4394
4396
DeclContext *outerDC,
4395
- PreparedOverload *preparedOverload);
4397
+ PreparedOverloadBuilder *preparedOverload);
4396
4398
4397
4399
// / Open the generic parameter list and its requirements,
4398
4400
// / creating type variables for each of the type parameters.
4399
4401
void openGeneric (DeclContext *outerDC,
4400
4402
GenericSignature signature,
4401
4403
ConstraintLocatorBuilder locator,
4402
4404
SmallVectorImpl<OpenedType> &replacements,
4403
- PreparedOverload *preparedOverload);
4405
+ PreparedOverloadBuilder *preparedOverload);
4404
4406
4405
4407
// / Open the generic parameter list creating type variables for each of the
4406
4408
// / type parameters.
4407
4409
void openGenericParameters (DeclContext *outerDC,
4408
4410
GenericSignature signature,
4409
4411
SmallVectorImpl<OpenedType> &replacements,
4410
4412
ConstraintLocatorBuilder locator,
4411
- PreparedOverload *preparedOverload);
4413
+ PreparedOverloadBuilder *preparedOverload);
4412
4414
4413
4415
// / Open a generic parameter into a type variable and record
4414
4416
// / it in \c replacements.
4415
4417
TypeVariableType *openGenericParameter (GenericTypeParamType *parameter,
4416
4418
ConstraintLocatorBuilder locator,
4417
- PreparedOverload *preparedOverload);
4419
+ PreparedOverloadBuilder *preparedOverload);
4418
4420
4419
4421
// / Given generic signature open its generic requirements,
4420
4422
// / using substitution function, and record them in the
@@ -4424,7 +4426,7 @@ class ConstraintSystem {
4424
4426
bool skipProtocolSelfConstraint,
4425
4427
ConstraintLocatorBuilder locator,
4426
4428
llvm::function_ref<Type(Type)> subst,
4427
- PreparedOverload *preparedOverload);
4429
+ PreparedOverloadBuilder *preparedOverload);
4428
4430
4429
4431
// Record the given requirement in the constraint system.
4430
4432
void openGenericRequirement (DeclContext *outerDC,
@@ -4434,18 +4436,18 @@ class ConstraintSystem {
4434
4436
bool skipProtocolSelfConstraint,
4435
4437
ConstraintLocatorBuilder locator,
4436
4438
llvm::function_ref<Type(Type)> subst,
4437
- PreparedOverload *preparedOverload);
4439
+ PreparedOverloadBuilder *preparedOverload);
4438
4440
4439
4441
// / Update OpenedTypes and record a change in the trail.
4440
4442
void recordOpenedType (
4441
4443
ConstraintLocator *locator, ArrayRef<OpenedType> openedTypes,
4442
- PreparedOverload *preparedOverload = nullptr );
4444
+ PreparedOverloadBuilder *preparedOverload = nullptr );
4443
4445
4444
4446
// / Record the set of opened types for the given locator.
4445
4447
void recordOpenedTypes (
4446
4448
ConstraintLocatorBuilder locator,
4447
4449
const SmallVectorImpl<OpenedType> &replacements,
4448
- PreparedOverload *preparedOverload = nullptr ,
4450
+ PreparedOverloadBuilder *preparedOverload = nullptr ,
4449
4451
bool fixmeAllowDuplicates = false );
4450
4452
4451
4453
// / Check whether the given type conforms to the given protocol and if
@@ -4458,7 +4460,7 @@ class ConstraintSystem {
4458
4460
FunctionType *fnType, Type baseType, ValueDecl *decl, DeclContext *dc,
4459
4461
unsigned numApplies, bool isMainDispatchQueue,
4460
4462
ArrayRef<OpenedType> replacements, ConstraintLocatorBuilder locator,
4461
- PreparedOverload *preparedOverload);
4463
+ PreparedOverloadBuilder *preparedOverload);
4462
4464
4463
4465
// / Retrieve the type of a reference to the given value declaration.
4464
4466
// /
@@ -4474,7 +4476,7 @@ class ConstraintSystem {
4474
4476
FunctionRefInfo functionRefInfo,
4475
4477
ConstraintLocatorBuilder locator,
4476
4478
DeclContext *useDC,
4477
- PreparedOverload *preparedOverload);
4479
+ PreparedOverloadBuilder *preparedOverload);
4478
4480
4479
4481
// / Return the type-of-reference of the given value.
4480
4482
// /
@@ -4516,7 +4518,7 @@ class ConstraintSystem {
4516
4518
Type baseTy, ValueDecl *decl, DeclContext *useDC, bool isDynamicLookup,
4517
4519
FunctionRefInfo functionRefInfo, ConstraintLocator *locator,
4518
4520
SmallVectorImpl<OpenedType> *replacements = nullptr ,
4519
- PreparedOverload *preparedOverload = nullptr );
4521
+ PreparedOverloadBuilder *preparedOverload = nullptr );
4520
4522
4521
4523
// / Retrieve a list of generic parameter types solver has "opened" (replaced
4522
4524
// / with a type variable) at the given location.
@@ -4936,7 +4938,11 @@ class ConstraintSystem {
4936
4938
prepareOverload (ConstraintLocator *locator,
4937
4939
OverloadChoice choice,
4938
4940
DeclContext *useDC,
4939
- PreparedOverload *preparedOverload);
4941
+ PreparedOverloadBuilder *preparedOverload);
4942
+
4943
+ void replayChanges (
4944
+ ConstraintLocatorBuilder locator,
4945
+ PreparedOverload preparedOverload);
4940
4946
4941
4947
// / Resolve the given overload set to the given choice.
4942
4948
void resolveOverload (ConstraintLocator *locator, Type boundType,
@@ -5351,13 +5357,13 @@ class ConstraintSystem {
5351
5357
ConstraintKind matchKind,
5352
5358
ConstraintLocator *locator,
5353
5359
ConstraintLocator *calleeLocator,
5354
- PreparedOverload *preparedOverload = nullptr );
5360
+ PreparedOverloadBuilder *preparedOverload = nullptr );
5355
5361
5356
5362
// / Used by applyPropertyWrapperToParameter() to update appliedPropertyWrappers
5357
5363
// / and record a change in the trail.
5358
5364
void applyPropertyWrapper (Expr *anchor,
5359
5365
AppliedPropertyWrapper applied,
5360
- PreparedOverload *preparedOverload = nullptr );
5366
+ PreparedOverloadBuilder *preparedOverload = nullptr );
5361
5367
5362
5368
// / Undo the above change.
5363
5369
void removePropertyWrapper (Expr *anchor);
0 commit comments