@@ -7362,14 +7362,16 @@ bool FailureDiagnosis::diagnoseMemberFailures(
7362
7362
// and the source range for y.
7363
7363
SourceRange memberRange;
7364
7364
SourceLoc BaseLoc;
7365
+ DeclNameLoc NameLoc;
7365
7366
7366
7367
Type baseTy, baseObjTy;
7367
7368
// UnresolvedMemberExpr doesn't have "base" expression,
7368
7369
// it's represented as ".foo", which means that we need
7369
7370
// to get base from the context.
7370
- if (isa <UnresolvedMemberExpr>(E)) {
7371
+ if (auto *UME = dyn_cast <UnresolvedMemberExpr>(E)) {
7371
7372
memberRange = E->getSourceRange ();
7372
7373
BaseLoc = E->getLoc ();
7374
+ NameLoc = UME->getNameLoc ();
7373
7375
baseTy = CS.getContextualType ();
7374
7376
if (!baseTy)
7375
7377
return false ;
@@ -7389,6 +7391,8 @@ bool FailureDiagnosis::diagnoseMemberFailures(
7389
7391
locator = simplifyLocator (CS, locator, memberRange);
7390
7392
7391
7393
BaseLoc = baseExpr->getLoc ();
7394
+ NameLoc = DeclNameLoc (memberRange.Start );
7395
+
7392
7396
// Retypecheck the anchor type, which is the base of the member expression.
7393
7397
baseExpr =
7394
7398
typeCheckArbitrarySubExprIndependently (baseExpr, TCC_AllowLValue);
@@ -7574,7 +7578,7 @@ bool FailureDiagnosis::diagnoseMemberFailures(
7574
7578
7575
7579
// FIXME: Dig out the property DeclNameLoc.
7576
7580
diagnoseUnviableLookupResults (result, baseObjTy, baseExpr, memberName,
7577
- DeclNameLoc (memberRange. Start ) , BaseLoc);
7581
+ NameLoc , BaseLoc);
7578
7582
return true ;
7579
7583
}
7580
7584
0 commit comments