Skip to content
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

Reject unusable overloaded curried functions #8021

Closed
scabug opened this issue Nov 29, 2013 · 4 comments
Closed

Reject unusable overloaded curried functions #8021

scabug opened this issue Nov 29, 2013 · 4 comments

Comments

@scabug
Copy link

scabug commented Nov 29, 2013

I can define this object Test without getting an error:

  object Test {
    def f(x: Integer)(y: Boolean) = ???
    def f(x: Integer)(y: String) = ???
  }

However, when I want to use the functions, I can't:

  Test.f(3)(true)     // Error: ambiguous reference to overloaded definition
  Test.f(3)("hello")  // Error: ambiguous reference to overloaded definition

It makes sense for me that this is impossible, but I would like to get an error already when I define f, not only when I want to use it.

Btw this happened in RxScala: There, this method:

https://github.com/Netflix/RxJava/blob/13cd6a9b1813c5dbe5fdd538f18a5f3a2e31e46f/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/Scheduler.scala#L122

clashes with this one:

https://github.com/Netflix/RxJava/blob/13cd6a9b1813c5dbe5fdd538f18a5f3a2e31e46f/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/Scheduler.scala#L158

and no error was emitted.

@scabug
Copy link
Author

scabug commented Nov 29, 2013

Imported From: https://issues.scala-lang.org/browse/SI-8021?orig=1
Reporter: Samuel Grütter (samuelgruetter)
Duplicates #2628

@scabug
Copy link
Author

scabug commented Nov 29, 2013

@paulp said:
Has previously been declared wontfix in #2628.

@scabug
Copy link
Author

scabug commented Nov 30, 2013

@som-snytt said:
The first overload is at line 63.

https://github.com/Netflix/RxJava/blob/13cd6a9b1813c5dbe5fdd538f18a5f3a2e31e46f/language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/Scheduler.scala#L63

Even if the overloads were selectable, it seems especially perilous because the second param list is either a function or =>Unit, and anything is convertible to Unit by value discarding, or so say the puzzlers.

@scabug scabug closed this as completed Nov 30, 2013
@scabug
Copy link
Author

scabug commented Nov 30, 2013

@retronym said:
Closing as a duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants