Skip to content

Commit 4a04960

Browse files
committed
[CSDiagnostics] Fix requirement source lookup to support member references
Fuzzing found a problem related to re-typecheck introducing `MemberRefExpr` into AST with failing requirements which are then diagnosed via fixes, quite unlikely case to be found in the wild. (cherry picked from commit 03d2831)
1 parent 7c76e4d commit 4a04960

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ ValueDecl *RequirementFailure::getDeclRef() const {
119119
ConstraintLocatorBuilder subscript(locator);
120120
locator = cs.getConstraintLocator(
121121
subscript.withPathElement(PathEltKind::SubscriptMember));
122+
} else if (isa<MemberRefExpr>(anchor)) {
123+
ConstraintLocatorBuilder memberRef(locator);
124+
locator =
125+
cs.getConstraintLocator(memberRef.withPathElement(PathEltKind::Member));
122126
}
123127

124128
auto overload = getOverloadChoiceIfAvailable(locator);

0 commit comments

Comments
 (0)