[CS] Use apply component locator for verifyThatArgumentIsHashable

For a method key path use the locator for the apply itself rather
than the member, ensuring we handle invalid cases where the apply is
the first component, and providing more accurate location info.
This commit is contained in:
Hamish Knight
2025-08-15 21:30:22 +01:00
parent 61d0486d12
commit 4423399fce
8 changed files with 26 additions and 16 deletions

View File

@@ -9221,9 +9221,10 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
// If this is an implicit Hashable conformance check generated for each
// index argument of the keypath subscript component, we could just treat
// it as though it conforms.
if ((loc->isResultOfKeyPathDynamicMemberLookup() ||
loc->isKeyPathSubscriptComponent()) ||
loc->isKeyPathMemberComponent()) {
if (loc->isResultOfKeyPathDynamicMemberLookup() ||
loc->isKeyPathSubscriptComponent() ||
loc->isKeyPathMemberComponent() ||
loc->isKeyPathApplyComponent()) {
if (protocol ==
getASTContext().getProtocol(KnownProtocolKind::Hashable)) {
auto *fix =