Skip to content

Overloading resolution failed when overloaded val and def have the same number of parameters #4854

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
Medowhill opened this issue Jul 27, 2018 · 1 comment

Comments

@Medowhill
Copy link
Contributor

class C {
  def f(x: Int): Unit = ()
  val f: String => Unit = s => ()
  f("a")
}

The above code is compiled in scalac but results the following error in dotc.

-- [E007] Type Mismatch Error: ../B.scala:4:4 ----------------------------------
4 |  f("a")
  |    ^^^
  |    found:    String("a")
  |    required: Int
  |
one error found

Is it an intended semantics of dotty?

@odersky
Copy link
Contributor

odersky commented Mar 8, 2020

This compiles in latest master

@odersky odersky closed this as completed Mar 8, 2020
odersky added a commit to dotty-staging/dotty that referenced this issue Mar 8, 2020
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

3 participants