-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fixit to remove empty argument for non-function calls #3196
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
Conversation
41b6497
to
8336558
Compare
Nice! Can we do something like this to support getter/setter to property change, e.g. Fixing I.getA() to I.A, when A is available of course. |
I'm sure we could! I don't think that's in scope for this patch, but we can make another one. That'll be more complicated, though |
It helps that most Cocoa getters have the same name as the property. |
@jrose-apple @nkcsgexi Should this fix-it be applied to a note that says why to remove the parens? |
Jordan may believe otherwise, but i think the error message itself is clear enough. |
@@ -305,7 +305,7 @@ class NSObjectable : NSObjectProtocol { | |||
// Properties with custom accessors | |||
func customAccessors(_ hive: Hive, bee: Bee) { | |||
markUsed(hive.isMakingHoney) | |||
markUsed(hive.makingHoney()) // expected-error{{cannot call value of non-function type 'Bool'}} | |||
markUsed(hive.makingHoney()) // expected-error{{cannot call value of non-function type 'Bool'}}{{28-29=}} |
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.
If I understand correctly, this fix-it only removes l-paren (
. Shouldn't it be {{28-30=}}
?
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.
Good catch!
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.
Thanks!
I agree with Xi on this one. Removing the parens is the obvious thing a human would try, and it's highly likely to be correct. |
8336558
to
2ec5a94
Compare
2ec5a94
to
6677818
Compare
@swift-ci please test |
@jrose-apple @rintaro good to merge? |
LGTM. |
Yep, looks good. |
What's in this pull request?
When attempting to call a non-function type with an empty tuple as arguments, remove the empty tuple and use the value directly.
This will be a big help to people who mistakenly use class methods that are now
class var
s in Objective-C.Resolved bug number: (N/A)
Before merging this pull request to apple/swift repository:
Triggering Swift CI
The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:
Smoke Testing
Validation Testing
Lint Testing
Note: Only members of the Apple organization can trigger swift-ci.