-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Gardening for @dynamicMemberLookup
.
#20498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gardening for @dynamicMemberLookup
.
#20498
Conversation
cc @lattner: could you please review? |
@dynamicMemberLookup
.@dynamicMemberLookup
.
@@ -3053,17 +3053,17 @@ getArgumentLabels(ConstraintSystem &cs, ConstraintLocatorBuilder locator) { | |||
/// conformances, but this is fine because it doesn't get invoked in the normal | |||
/// name lookup path (only when lookup is about to fail). | |||
static bool hasDynamicMemberLookupAttribute(CanType ty, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deduping this function with getDynamicCallableMethods
(which also defines the same "type traversal" logic) would be nice. However, the two functions use different cache types (llvm::DenseMap<CanType, bool>
vs llvm::DenseMap<CanType, DynamicCallableMethods>
), which makes generalization difficult. 🙁
Any generalization ideas appreciated.
- Unify code style of `@dynamicMemberLookup` and `@dynamicCallable` implementations. - Use consistent variable names, doc comments, etc. - Move `@dynamicMemberLookup` test to `test/attr` directory.
b98388b
to
6583acd
Compare
@swift-ci Please smoke test |
1 similar comment
@swift-ci Please smoke test |
This all LGTM, but please fix the attr/attr_dynamic_member_lookup.swift failure. |
Address comment by @xwu.
18a8ea9
to
9f46a53
Compare
Sorry, tests failed because I updated the diagnostic message without updating tests. |
@dynamicMemberLookup
and@dynamicCallable
implementations.@dynamicMemberLookup
test totest/attr
directory.New consistent naming:
invalid_dynamic_callable_type
,invalid_dynamic_member_lookup_type
DynamicCallableCache
,DynamicMemberLookupCache
isValidDynamicCallableMethod
,isValidDynamicMemberLookupSubscript
This PR is almost NFC. The only user-facing change is a new error message for
invalid_dynamic_member_lookup_type
.