Skip to content

[Typechecker] @dynamicMemberLookup can't find subscript without arg label #26823

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

Merged
merged 1 commit into from
Aug 25, 2019
Merged

[Typechecker] @dynamicMemberLookup can't find subscript without arg label #26823

merged 1 commit into from
Aug 25, 2019

Conversation

theblixguy
Copy link
Collaborator

If we don't have a subscript with an argument label, then @dynamicMemberLookup will complain about not finding a subscript(dynamicMember:). For example:

// error: @dynamicMemberLookup attribute requires 'S' to have a 
//        'subscript(dynamicMember:)' method that accepts either 
//        'ExpressibleByStringLiteral' or a keypath
@dynamicMemberLookup 
struct S {
  subscript(dynamicMember: String) -> String {
    fatalError()
  }
}

This can be improved by emitting another diagnostic to tell the user that they need to add an explicit argument label to satisfy the @dynamicMemberLookup requirement.

Resolves SR-10557.

@theblixguy theblixguy requested review from xedin and dan-zheng August 24, 2019 23:15
@theblixguy
Copy link
Collaborator Author

theblixguy commented Aug 24, 2019

Let's see if this works:

@swift-ci please smoke test

@theblixguy
Copy link
Collaborator Author

Hm, I can't seem to run the CI. I think my GitHub ID hasn't been added to the approved users list yet. cc @shahmishal

Copy link
Contributor

@xedin xedin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

@xedin
Copy link
Contributor

xedin commented Aug 25, 2019

@swift-ci please smoke test

@theblixguy
Copy link
Collaborator Author

It seems like the OSX test is stuck on the last LLDB suite test...

@xedin
Copy link
Contributor

xedin commented Aug 25, 2019

@swift-ci please smoke test macOS platform

@xedin xedin merged commit 6b0070c into swiftlang:master Aug 25, 2019
@theblixguy theblixguy deleted the fix/SR_10557 branch August 25, 2019 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants