[Sema] Diagnose method arg captures that are not Hashable/Equatable.

This commit is contained in:
Amritpan Kaur
2025-01-16 19:07:00 -08:00
parent 970159c09d
commit a96b780a28
6 changed files with 36 additions and 8 deletions

View File

@@ -719,8 +719,8 @@ ERROR(expr_swift_keypath_empty, none,
"key path must have at least one component", ())
ERROR(expr_string_interpolation_outside_string,none,
"string interpolation can only appear inside a string literal", ())
ERROR(expr_keypath_subscript_index_not_hashable, none,
"subscript index of type %0 in a key path must be Hashable", (Type))
ERROR(expr_keypath_arg_or_index_not_hashable, none,
"%select{method argument|subscript index}0 of type %1 in a key path must be Hashable", (bool, Type))
ERROR(expr_smart_keypath_application_type_mismatch,none,
"key path of type %0 cannot be applied to a base of type %1",
(Type, Type))

View File

@@ -256,6 +256,10 @@ public:
/// of the key path at some index.
bool isKeyPathSubscriptComponent() const;
/// Determine whether this locator points to a member component
/// of the key path at some index.
bool isKeyPathMemberComponent() const;
/// Determine whether this locator points to the member found
/// via key path dynamic member lookup.
bool isForKeyPathDynamicMemberLookup() const;