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

Regression in implicit resolution #8687

Closed
scabug opened this issue Jun 27, 2014 · 2 comments
Closed

Regression in implicit resolution #8687

scabug opened this issue Jun 27, 2014 · 2 comments
Labels
fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) should compile
Milestone

Comments

@scabug
Copy link

scabug commented Jun 27, 2014

The following example compiles in 2.10.4 but fails to compile in 2.11.1 with the following message:

src/test/test2.scala:43: could not find implicit value for parameter c: test2.Combined[[x]test2.Coproduct[test2.T1,test2.T2,x],test2.T2]
   val t2 = t1.test(_ => Test2(1))
                   ^
package test2

import scala.language.higherKinds
import scala.language.implicitConversions

case class Coproduct[F[_], G[_], x](value: Either[F[x], G[x]])

trait Combined[F[_], G[_]] {
  type T[x]
}

trait LowPriority {

  implicit def pair[F[_], G[_]] =
    new Combined[F, G] {
      type T[x] = Coproduct[F, G, x]
    }
}

object Combined extends LowPriority {

  type Aux[F[_], G[_], O[_]] = Combined[F, G] { type T[x] = O[x] }

  implicit def single[F[_]] =
    new Combined[F, F] {
      type T[x] = F[x]
    }
}

trait T1[A]
case class Test1(a: String) extends T1[String]
trait T2[A]
case class Test2(a: Int) extends T2[Int]

object test {

  class Test[F[_], A](f: F[A]) {
    def test[G[_], B](fg: A => G[B])(implicit c: Combined[F, G]): Test[c.T, B] = ???
  }

  val t = new Test(Test1("a"))
  val t1 = t.test(_ => Test2(1))
  val t2 = t1.test(_ => Test2(1))
}
@scabug
Copy link
Author

scabug commented Jun 27, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8687?orig=1
Reporter: Erik Westra (eecolor)
Affected Versions: 2.11.1

@SethTisue SethTisue added this to the 2.13.0 milestone Aug 1, 2023
@SethTisue SethTisue added the fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) label Aug 1, 2023
@SethTisue
Copy link
Member

still fails in 2.12.18, but seems fixed in 2.13 and 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) should compile
Projects
None yet
Development

No branches or pull requests

2 participants