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
[SR-13657] Ambiguous use of function
when used within a namespace or as an instance method
#56092
Comments
Comment by Shai Mishali (JIRA) This is effecting RxSwift's code base seemingly |
Does this is a Tensorflow(TF) specific issue? Seem to me like this is a Swift(SR) issue right? |
Comment by Mark Sands (JIRA) @LucianoPAlmeida oops—I didn't mean to file this under tensor flow. Is it possible to move tickets? Or should I close this and re-file it under the appropriate project? Edit: I moved the ticket. I should have checked before I pinged you. But thanks for calling that to my attention! |
Ah no worries 🙂 |
@swift-ci create |
Comment by Shai Mishali (JIRA) @LucianoPAlmeida I don't entirely understand this -
|
Hey freak4pc (JIRA User) class A {
func f(_ param: Int...) {}
}
A().f() // it's ok because variadic functions accept 0 or more arguments. So I agree that the behavior should be unified, but as I mentioned above I think it should be ambiguous in both cases (global and member) because there is no specific rule on the language (as far as I know) that tells a function with all parameters defaulted should be favored over a variadic one and vice-versa. I mean why choose one overload over the other? One could make a case for the default parameter one because it maintains the same behavior as: enum Driver {
static func drive(_ variadics: Int...) -> Int {
return 42
}
static func drive() -> Int {
return 42
}
}
Driver.drive() // It's ok as it chooses the empty one But in fact, the correct here could be ambiguous too but I think the empty param one chosen because of a rule that favors it based o an equal number of arguments Line 738 in 8f30626
But those are only my thought on this, @xedin or @DougGregor should know that better 🙂 |
Additional Detail from JIRA
md5: 0c2fbedba8b4440f9e12f2e520c1aced
Issue Description:
The following usage of the function `drive` is ambiguous, but only when used within a namespace or a method.
The text was updated successfully, but these errors were encountered: