@@ -503,43 +503,31 @@ Type ConstraintSystem::getUnopenedTypeOfReference(
503
503
VarDecl *value, Type baseType, DeclContext *UseDC,
504
504
ConstraintLocator *locator, bool wantInterfaceType,
505
505
bool adjustForPreconcurrency) {
506
- return ConstraintSystem::getUnopenedTypeOfReference (
507
- value, baseType, UseDC,
508
- [&](VarDecl *var) -> Type {
509
- if (Type type = getTypeIfAvailable (var))
510
- return type;
511
-
512
- if (!var->hasInterfaceType ()) {
513
- return ErrorType::get (getASTContext ());
514
- }
515
-
516
- return wantInterfaceType ? var->getInterfaceType () : var->getTypeInContext ();
517
- },
518
- locator, wantInterfaceType, adjustForPreconcurrency,
519
- GetClosureType{*this },
520
- ClosureIsolatedByPreconcurrency{*this },
521
- IsInLeftHandSideOfAssignment{*this });
522
- }
506
+ Type requestedType;
507
+ if (Type type = getTypeIfAvailable (value)) {
508
+ requestedType = type;
509
+ } else if (!value->hasInterfaceType ()) {
510
+ requestedType = ErrorType::get (getASTContext ());
511
+ } else {
512
+ requestedType = (wantInterfaceType
513
+ ? value->getInterfaceType ()
514
+ : value->getTypeInContext ());
515
+ }
523
516
524
- Type ConstraintSystem::getUnopenedTypeOfReference (
525
- VarDecl *value, Type baseType, DeclContext *UseDC,
526
- llvm::function_ref<Type(VarDecl *)> getType,
527
- ConstraintLocator *locator,
528
- bool wantInterfaceType, bool adjustForPreconcurrency,
529
- llvm::function_ref<Type(const AbstractClosureExpr *)> getClosureType,
530
- llvm::function_ref<bool(const ClosureExpr *)> isolatedByPreconcurrency,
531
- llvm::function_ref<bool(Expr *)> isAssignTarget) {
532
- Type requestedType =
533
- getType (value)->getWithoutSpecifierType ()->getReferenceStorageReferent ();
517
+ requestedType =
518
+ requestedType->getWithoutSpecifierType ()->getReferenceStorageReferent ();
534
519
535
520
// Strip pack expansion types off of pack references.
536
521
if (auto *expansion = requestedType->getAs <PackExpansionType>())
537
522
requestedType = expansion->getPatternType ();
538
523
539
524
// Adjust the type for concurrency if requested.
540
- if (adjustForPreconcurrency)
525
+ if (adjustForPreconcurrency) {
541
526
requestedType = adjustVarTypeForConcurrency (
542
- requestedType, value, UseDC, getClosureType, isolatedByPreconcurrency);
527
+ requestedType, value, UseDC,
528
+ GetClosureType{*this },
529
+ ClosureIsolatedByPreconcurrency{*this });
530
+ }
543
531
544
532
// If we're dealing with contextual types, and we referenced this type from
545
533
// a different context, map the type.
@@ -553,7 +541,8 @@ Type ConstraintSystem::getUnopenedTypeOfReference(
553
541
554
542
// Qualify storage declarations with an lvalue when appropriate.
555
543
// Otherwise, they yield rvalues (and the access must be a load).
556
- if (doesStorageProduceLValue (value, baseType, UseDC, isAssignTarget,
544
+ if (doesStorageProduceLValue (value, baseType, UseDC,
545
+ IsInLeftHandSideOfAssignment{*this },
557
546
locator) &&
558
547
!requestedType->hasError ()) {
559
548
return LValueType::get (requestedType);
0 commit comments