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

type inference via dependent typing breaks with varargs #11488

lJoublanc opened this issue Apr 15, 2019 · 1 comment


None yet
3 participants
Copy link

commented Apr 15, 2019

Below is an reproduction of the problem, on both 2.12.8 and 2.13.0-M5.

scala> :paste
// Entering paste mode (ctrl-D to finish)

object Bug { 
  import java.nio._

    def apply[T,B](ts: T*)(implicit I: Implicit.Aux[T,B]): Either[T,B] = 

  trait Implicit[A] { type Out}

  object Implicit {
    type Aux[A, B] = Implicit[A] { type Out = B }

  implicit def instance: Implicit.Aux[Double,java.nio.DoubleBuffer] = 
    new Implicit[Double] {
      type Out = DoubleBuffer

// Exiting paste mode, now interpreting.

defined object Bug

scala> Bug(1.0,2.0)
res1: scala.util.Either[Double,this.Out] = Left(1.0)

scala> Bug(1.0)
res2: Either[Double,java.nio.DoubleBuffer] = Left(1.0)

Note that in the first case the type inference via the Aux pattern fails to work. It should return an Either[Double,DoubleBuffer]. However, if works just fine with a single argument.


This comment has been minimized.

Copy link

commented Apr 24, 2019

Like a bunch of over type inference issue, that one is also fixed in dotty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.