milessabin / si2712fix-demo

This repository contains a minimal SBT project for experimenting with a fix for SI-2712
19 stars 3 forks source link

Case where unification fails #10

Open m50d opened 7 years ago

m50d commented 7 years ago

Simplified/standalone version of the first failure case I'm hitting from tierney. I have no idea whether this case is even possible to fix, but figured it was worth raising. testSuccess compiles (by passing explicit type parameters), testFail does not.

object Demo {
  trait Free1[F[_], A]
  trait Free2[F[_], A]
  trait Cp[F[_], G[_], A]

  class Fix[W[_[_[_], _], _[_], _], F[_], A]()
  type Unfixed[S[_[_], _], F[_], A] = 
    Cp[F, Free1[Free2[S[F, ?], ?], ?], A]

  trait Command[A]

  def unify[F[_], A](value: F[A]): Unit = {}

  def testSuccess(v: Free2[Fix[Unfixed, Command, ?], String]) =
    unify[Free2[Fix[Unfixed, Command, ?], ?], String](v)

  def testFail(v: Free2[Fix[Unfixed, Command, ?], String]) =
    unify(v)
}
milessabin commented 7 years ago

The SI-2712 fix has been merged in both Scala 2.11.x and 2.12.x now, so the Scala issue tracker is now the right place to report problems like this.