Skip to content

Overload perturbs extension with varargs #12133

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

Closed
rjolly opened this issue Apr 17, 2021 · 3 comments · Fixed by #12138
Closed

Overload perturbs extension with varargs #12133

rjolly opened this issue Apr 17, 2021 · 3 comments · Fixed by #12138
Milestone

Comments

@rjolly
Copy link
Contributor

rjolly commented Apr 17, 2021

Compiler version

3.0.0-RC2

Minimized code and output

class B

class A {
  def foo(x: B) = ???
  def foo(str: String) = ???
}

extension (x: A) def foo(s: Int*) = s.size

val a = new A

println(a.foo(1, 2))
//        ^^^^
//        Found:    (Int, Int)
//        Required: Int

Expectation : should work as when there's no overload:

class A {
  def foo(x: B) = ???
//def foo(str: String) = ???
}

println(a.foo(1, 2))
// 2

Note that when there's just one parameter it also works

class A {
  def foo(x: B) = ???
  def foo(str: String) = ???
}

println(a.foo(1))
// 1
@odersky
Copy link
Contributor

odersky commented Apr 18, 2021

It works for me on master.

@rjolly
Copy link
Contributor Author

rjolly commented Apr 18, 2021

Puzzling. I just tried with 3.0.1-RC1-bin-20210417-c57aa0a-NIGHTLY and it does not work.

@odersky
Copy link
Contributor

odersky commented Apr 18, 2021

I missed a line when I copied. I can reproduce it now.

odersky added a commit to dotty-staging/dotty that referenced this issue Apr 18, 2021
Instead of a state based hidden side channel between adapt and realApply,
use only a hint, and check again.

Fies scala#12133
odersky added a commit to dotty-staging/dotty that referenced this issue Apr 18, 2021
Instead of a state based hidden side channel between adapt and realApply,
use only a hint, and check again.

Fies scala#12133
liufengyun pushed a commit that referenced this issue Apr 19, 2021
Instead of a state based hidden side channel between adapt and realApply,
use only a hint, and check again.

Fies #12133
michelou pushed a commit to michelou/scala3 that referenced this issue Apr 19, 2021
Instead of a state based hidden side channel between adapt and realApply,
use only a hint, and check again.

Fies scala#12133
@Kordyjan Kordyjan added this to the 3.0.1 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants