@@ -4170,15 +4170,6 @@ class ConstraintSystem {
4170
4170
}
4171
4171
4172
4172
private:
4173
- // / Adjust the constraint system to accommodate the given selected overload, and
4174
- // / recompute the type of the referenced declaration.
4175
- // /
4176
- // / \returns a pair containing the adjusted opened type of a reference to
4177
- // / this member and a bit indicating whether or not a bind constraint was added.
4178
- std::pair<Type, bool > adjustTypeOfOverloadReference (
4179
- const OverloadChoice &choice, ConstraintLocator *locator, Type boundType,
4180
- Type refType);
4181
-
4182
4173
// / Add the constraints needed to bind an overload's type variable.
4183
4174
void bindOverloadType (
4184
4175
const SelectedOverload &overload, Type boundType,
@@ -4490,6 +4481,12 @@ class ConstraintSystem {
4490
4481
TypeMatchOptions flags, ConstraintLocatorBuilder locator,
4491
4482
llvm::function_ref<TypeMatchResult()> formUnsolvedResult);
4492
4483
4484
+ // / Matches two function result types for a function application. This is
4485
+ // / usually a bind, but also handles e.g IUO unwraps.
4486
+ TypeMatchResult matchFunctionResultTypes (Type expectedResult, Type fnResult,
4487
+ TypeMatchOptions flags,
4488
+ ConstraintLocatorBuilder locator);
4489
+
4493
4490
public: // FIXME: public due to statics in CSSimplify.cpp
4494
4491
// / Attempt to match up types \c type1 and \c type2, which in effect
4495
4492
// / is solving the given type constraint between these two types.
@@ -4525,40 +4522,6 @@ class ConstraintSystem {
4525
4522
}
4526
4523
4527
4524
public:
4528
- // / Given a function type where the eventual result type is an optional,
4529
- // / where "eventual result type" is defined as:
4530
- // / 1. The result type is an optional
4531
- // / 2. The result type is a function type with an eventual result
4532
- // / type that is an optional.
4533
- // /
4534
- // / return the same function type but with the eventual result type
4535
- // / replaced by its underlying type.
4536
- // /
4537
- // / i.e. return (S) -> T for (S) -> T?
4538
- // return (X) -> () -> Y for (X) -> () -> Y?
4539
- Type replaceFinalResultTypeWithUnderlying (AnyFunctionType *fnTy) {
4540
- auto resultTy = fnTy->getResult ();
4541
- if (auto *resultFnTy = resultTy->getAs <AnyFunctionType>())
4542
- resultTy = replaceFinalResultTypeWithUnderlying (resultFnTy);
4543
- else {
4544
- auto objType =
4545
- resultTy->getWithoutSpecifierType ()->getOptionalObjectType ();
4546
- // Preserve l-value through force operation.
4547
- resultTy =
4548
- resultTy->is <LValueType>() ? LValueType::get (objType) : objType;
4549
- }
4550
-
4551
- assert (resultTy);
4552
-
4553
- if (auto *genericFn = fnTy->getAs <GenericFunctionType>()) {
4554
- return GenericFunctionType::get (genericFn->getGenericSignature (),
4555
- genericFn->getParams (), resultTy,
4556
- genericFn->getExtInfo ());
4557
- }
4558
-
4559
- return FunctionType::get (fnTy->getParams (), resultTy, fnTy->getExtInfo ());
4560
- }
4561
-
4562
4525
// Build a disjunction that attempts both T? and T for a particular
4563
4526
// type binding. The choice of T? is preferred, and we will not
4564
4527
// attempt T if we can type check with T?
0 commit comments