Skip to content

Commit 8f0eaff

Browse files
committed
Sema: Plumb PreparedOverload into getTypeOfReferenceWithSpecialTypeCheckingSemantics()
1 parent 02cc5a2 commit 8f0eaff

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

lib/Sema/TypeOfReference.cpp

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2377,7 +2377,8 @@ isInvalidPartialApplication(ConstraintSystem &cs,
23772377
/// the full opened type and the reference's type.
23782378
static DeclReferenceType getTypeOfReferenceWithSpecialTypeCheckingSemantics(
23792379
ConstraintSystem &CS, ConstraintLocator *locator,
2380-
DeclTypeCheckingSemantics semantics) {
2380+
DeclTypeCheckingSemantics semantics,
2381+
PreparedOverload *preparedOverload) {
23812382
switch (semantics) {
23822383
case DeclTypeCheckingSemantics::Normal:
23832384
llvm_unreachable("Decl does not have special type checking semantics!");
@@ -2389,17 +2390,18 @@ static DeclReferenceType getTypeOfReferenceWithSpecialTypeCheckingSemantics(
23892390
// be expressed in the type system currently.
23902391
auto input = CS.createTypeVariable(
23912392
CS.getConstraintLocator(locator, ConstraintLocator::FunctionArgument),
2392-
TVO_CanBindToNoEscape);
2393+
TVO_CanBindToNoEscape, preparedOverload);
23932394
auto output = CS.createTypeVariable(
23942395
CS.getConstraintLocator(locator, ConstraintLocator::FunctionResult),
2395-
TVO_CanBindToNoEscape);
2396+
TVO_CanBindToNoEscape, preparedOverload);
23962397

23972398
FunctionType::Param inputArg(input,
23982399
CS.getASTContext().getIdentifier("of"));
23992400

24002401
CS.addConstraint(
24012402
ConstraintKind::DynamicTypeOf, output, input,
2402-
CS.getConstraintLocator(locator, ConstraintLocator::DynamicType));
2403+
CS.getConstraintLocator(locator, ConstraintLocator::DynamicType),
2404+
/*isFavored=*/false, preparedOverload);
24032405
// FIXME: Verify ExtInfo state is correct, not working by accident.
24042406
FunctionType::ExtInfo info;
24052407
auto refType = FunctionType::get({inputArg}, output, info);
@@ -2411,18 +2413,19 @@ static DeclReferenceType getTypeOfReferenceWithSpecialTypeCheckingSemantics(
24112413
// @escaping.
24122414
auto noescapeClosure = CS.createTypeVariable(
24132415
CS.getConstraintLocator(locator, ConstraintLocator::FunctionArgument),
2414-
TVO_CanBindToNoEscape);
2416+
TVO_CanBindToNoEscape, preparedOverload);
24152417
auto escapeClosure = CS.createTypeVariable(
24162418
CS.getConstraintLocator(locator, ConstraintLocator::FunctionArgument),
2417-
TVO_CanBindToNoEscape);
2419+
TVO_CanBindToNoEscape, preparedOverload);
24182420
CS.addConstraint(ConstraintKind::EscapableFunctionOf, escapeClosure,
2419-
noescapeClosure, CS.getConstraintLocator(locator));
2421+
noescapeClosure, CS.getConstraintLocator(locator),
2422+
/*isFavored=*/false, preparedOverload);
24202423
auto result = CS.createTypeVariable(
24212424
CS.getConstraintLocator(locator, ConstraintLocator::FunctionResult),
2422-
TVO_CanBindToNoEscape);
2425+
TVO_CanBindToNoEscape, preparedOverload);
24232426
auto thrownError = CS.createTypeVariable(
24242427
CS.getConstraintLocator(locator, ConstraintLocator::ThrownErrorType),
2425-
0);
2428+
0, preparedOverload);
24262429
FunctionType::Param arg(escapeClosure);
24272430
auto bodyClosure = FunctionType::get(arg, result,
24282431
FunctionType::ExtInfoBuilder()
@@ -2448,18 +2451,19 @@ static DeclReferenceType getTypeOfReferenceWithSpecialTypeCheckingSemantics(
24482451
// existential type as its input.
24492452
auto openedTy = CS.createTypeVariable(
24502453
CS.getConstraintLocator(locator, ConstraintLocator::FunctionArgument),
2451-
TVO_CanBindToNoEscape);
2454+
TVO_CanBindToNoEscape, preparedOverload);
24522455
auto existentialTy = CS.createTypeVariable(
24532456
CS.getConstraintLocator(locator, ConstraintLocator::FunctionArgument),
2454-
TVO_CanBindToNoEscape);
2457+
TVO_CanBindToNoEscape, preparedOverload);
24552458
CS.addConstraint(ConstraintKind::OpenedExistentialOf, openedTy,
2456-
existentialTy, CS.getConstraintLocator(locator));
2459+
existentialTy, CS.getConstraintLocator(locator),
2460+
/*isFavored=*/false, preparedOverload);
24572461
auto result = CS.createTypeVariable(
24582462
CS.getConstraintLocator(locator, ConstraintLocator::FunctionResult),
2459-
TVO_CanBindToNoEscape);
2463+
TVO_CanBindToNoEscape, preparedOverload);
24602464
auto thrownError = CS.createTypeVariable(
24612465
CS.getConstraintLocator(locator, ConstraintLocator::ThrownErrorType),
2462-
0);
2466+
0, preparedOverload);
24632467
FunctionType::Param bodyArgs[] = {FunctionType::Param(openedTy)};
24642468
auto bodyClosure = FunctionType::get(bodyArgs, result,
24652469
FunctionType::ExtInfoBuilder()

0 commit comments

Comments
 (0)