@@ -1561,8 +1561,8 @@ void CalleeCandidateInfo::collectCalleeCandidates(Expr *fn,
1561
1561
auto ctors = CS.TC.lookupConstructors(
1562
1562
CS.DC, instanceType, NameLookupFlags::IgnoreAccessibility);
1563
1563
for (auto ctor : ctors)
1564
- if (ctor->hasInterfaceType())
1565
- candidates.push_back({ ctor, 1 });
1564
+ if (ctor.getValueDecl() ->hasInterfaceType())
1565
+ candidates.push_back({ ctor.getValueDecl() , 1 });
1566
1566
}
1567
1567
1568
1568
declName = instanceType->getString();
@@ -2490,10 +2490,10 @@ findCorrectEnumCaseName(Type Ty, LookupResult &Result,
2490
2490
return DeclName();
2491
2491
llvm::SmallVector<DeclName, 4> candidates;
2492
2492
for (auto &correction : Result) {
2493
- DeclName correctName = correction.Decl ->getFullName();
2493
+ DeclName correctName = correction.getValueDecl() ->getFullName();
2494
2494
if (!correctName.isSimpleName())
2495
2495
continue;
2496
- if (!isa<EnumElementDecl>(correction.Decl ))
2496
+ if (!isa<EnumElementDecl>(correction.getValueDecl() ))
2497
2497
continue;
2498
2498
if (correctName.getBaseIdentifier().str().equals_lower(
2499
2499
memberName.getBaseIdentifier().str()))
@@ -2571,7 +2571,8 @@ diagnoseUnviableLookupResults(MemberLookupResult &result, Type baseObjTy,
2571
2571
2572
2572
// Note all the correction candidates.
2573
2573
for (auto &correction : correctionResults) {
2574
- CS.TC.noteTypoCorrection(memberName, nameLoc, correction);
2574
+ CS.TC.noteTypoCorrection(memberName, nameLoc,
2575
+ correction.getValueDecl());
2575
2576
}
2576
2577
2577
2578
// TODO: recover?
@@ -2967,7 +2968,7 @@ bool FailureDiagnosis::diagnoseGeneralConversionFailure(Constraint *constraint){
2967
2968
auto LookupResult = CS.TC.lookupMember(
2968
2969
CS.DC, fromType, DeclName(CS.TC.Context.getIdentifier("boolValue")));
2969
2970
if (!LookupResult.empty()) {
2970
- if (isa<VarDecl>(LookupResult.begin()->Decl )) {
2971
+ if (isa<VarDecl>(LookupResult.begin()->getValueDecl() )) {
2971
2972
if (anchor->canAppendPostfixExpression())
2972
2973
diagnose(anchor->getLoc(), diag::types_not_convertible_use_bool_value,
2973
2974
fromType, toType).fixItInsertAfter(anchor->getEndLoc(),
@@ -4776,23 +4777,24 @@ static bool diagnoseImplicitSelfErrors(Expr *fnExpr, Expr *argExpr,
4776
4777
4777
4778
CandidateMap candidates;
4778
4779
for (const auto &candidate : result) {
4779
- auto base = candidate.Base;
4780
- if ((base && base->isInvalid()) || candidate->isInvalid())
4780
+ auto base = candidate.getBaseDecl();
4781
+ auto decl = candidate.getValueDecl();
4782
+ if ((base && base->isInvalid()) || decl->isInvalid())
4781
4783
continue;
4782
4784
4783
4785
// If base is present but it doesn't represent a valid nominal,
4784
4786
// we can't use current candidate as one of the choices.
4785
4787
if (base && !base->getInterfaceType()->getNominalOrBoundGenericNominal())
4786
4788
continue;
4787
4789
4788
- auto context = candidate ->getDeclContext();
4790
+ auto context = decl ->getDeclContext();
4789
4791
// We are only interested in static or global functions, because
4790
4792
// there is no way to call anything else properly.
4791
- if (!candidate ->isStatic() && !context->isModuleScopeContext())
4793
+ if (!decl ->isStatic() && !context->isModuleScopeContext())
4792
4794
continue;
4793
4795
4794
4796
OverloadChoice choice(base ? base->getInterfaceType() : nullptr,
4795
- candidate , UDE->getFunctionRefKind());
4797
+ decl , UDE->getFunctionRefKind());
4796
4798
4797
4799
if (base) { // Let's group all of the candidates have a common base.
4798
4800
candidates[base].push_back(choice);
@@ -7637,7 +7639,7 @@ static bool diagnoseKeyPathComponents(ConstraintSystem &CS, KeyPathExpr *KPE,
7637
7639
// Note all the correction candidates.
7638
7640
for (auto &result : lookup) {
7639
7641
TC.noteTypoCorrection(componentName, DeclNameLoc(componentNameLoc),
7640
- result);
7642
+ result.getValueDecl() );
7641
7643
}
7642
7644
7643
7645
isInvalid = true;
@@ -7651,13 +7653,14 @@ static bool diagnoseKeyPathComponents(ConstraintSystem &CS, KeyPathExpr *KPE,
7651
7653
// If we have more than one result, filter out unavailable or
7652
7654
// obviously unusable candidates.
7653
7655
if (lookup.size() > 1) {
7654
- lookup.filter([&](LookupResult::Result result) -> bool {
7656
+ lookup.filter([&](LookupResultEntry result) -> bool {
7655
7657
// Drop unavailable candidates.
7656
- if (result->getAttrs().isUnavailable(TC.Context))
7658
+ if (result.getValueDecl() ->getAttrs().isUnavailable(TC.Context))
7657
7659
return false;
7658
7660
7659
7661
// Drop non-property, non-type candidates.
7660
- if (!isa<VarDecl>(result.Decl) && !isa<TypeDecl>(result.Decl))
7662
+ if (!isa<VarDecl>(result.getValueDecl()) &&
7663
+ !isa<TypeDecl>(result.getValueDecl()))
7661
7664
return false;
7662
7665
7663
7666
return true;
@@ -7677,13 +7680,14 @@ static bool diagnoseKeyPathComponents(ConstraintSystem &CS, KeyPathExpr *KPE,
7677
7680
TC.diagnose(componentNameLoc, diag::ambiguous_decl_ref, componentName);
7678
7681
7679
7682
for (auto result : lookup) {
7680
- TC.diagnose(result, diag::decl_declared_here, result->getFullName());
7683
+ TC.diagnose(result.getValueDecl(), diag::decl_declared_here,
7684
+ result.getValueDecl()->getFullName());
7681
7685
}
7682
7686
isInvalid = true;
7683
7687
break;
7684
7688
}
7685
7689
7686
- auto found = lookup.front().Decl ;
7690
+ auto found = lookup.front().getValueDecl() ;
7687
7691
7688
7692
// Handle property references.
7689
7693
if (auto var = dyn_cast<VarDecl>(found)) {
0 commit comments