-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)
Description
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] =
Left(ts.head)
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)