Open WojciechMazur opened 1 month ago
The same commit pointed out by bisect leads to failures in other projects
julianpeeters/dynamical
//> using options -Ykind-projector:underscores
sealed trait Monomial[A, B, Y]
object Monomial:
case class Interface[A, B, Y](yᵉˣᵖ: A => Y, coeff: B) extends Monomial[A, B, Y]
case class Store[S, Y](yᵉˣᵖ: S => Y, coeff: S) extends Monomial[S, S, Y]
case class StoreF[F[_], S, Y](yᵉˣᵖ: F[S] => Y, coeff: S) extends Monomial[F[S], S, Y]
import Monomial.{Store, Interface, StoreF}
trait Mealy[P[_]]:
def init[Y]: Init[P, Y]
type ~>[P[_], Q[_]] = PolyMap[P, Q, _]
abstract class PolyMap[P[_], Q[_], Y]
type Init[P[_], Y] = P[Y] match
case PolyMap[p, q, Y] => Init[p, Y]
case Store[s, Y] => s
case StoreF[f, s, Y] => s
case Interface[a, b, Y] => b
case Tensor[p, q, Y] => (Init[p, Y], Init[q, Y])
type ⊗[P[_], Q[_]] = Tensor[P, Q, _]
abstract class Tensor[P[_], Q[_], Y]
object tensors:
extension [S1, S2, A1, B1, A2, B2] (m1: Mealy[Store[S1, _] ~> Interface[A1, A1 => B1, _]])
def ⊗(m2: Mealy[Store[S2, _] ~> Interface[A2, A2 => B2, _]]): Mealy[(Store[S1, _] ⊗ Store[S2, _]) ~> (Interface[A1, A1 => B1, _] ⊗ Interface[A2, A2 => B2, _])] =
new Mealy[(Store[S1, _] ⊗ Store[S2, _]) ~> (Interface[A1, A1 => B1, _] ⊗ Interface[A2, A2 => B2, _])]:
def init[Y]: Init[(Store[S1, _] ⊗ Store[S2, _]) ~> (Interface[A1, A1 => B1, _] ⊗ Interface[A2, A2 => B2, _]), Y] =
(m1.init, m2.init)
[error] ./src/main/scala/usage.scala:31:12
[error] Found: Init[
[error] ([_] =>> Monomial.Store[S1, _]) ~>
[error] ([_²] =>> Monomial.Interface[A1, A1 => B1, _²]),
[error] Y]
[error] Required: S1
[error]
[error] where: Y is a type variable
[error] _ is a type variable
[error] _² is a type variable
[error] (m1.init, m2.init)
[error] ^^^^^^^
[error] ./src/main/scala/usage.scala:31:21
[error] Found: Init[
[error] ([_] =>> Monomial.Store[S2, _]) ~>
[error] ([_²] =>> Monomial.Interface[A2, A2 => B2, _²]),
[error] Y]
[error] Required: S2
[error]
[error] where: Y is a type variable
[error] _ is a type variable
[error] _² is a type variable
[error] (m1.init, m2.init)
[error]
@sjrd Can you take a look to see whether the breakages are inevitable or whether there is some mitigation?
I'll have a look on Monday.
Compiler version
Last good release: 3.6.0-RC1-bin-20240719-af933c4-NIGHTLY First bad release: 3.6.0-RC1-bin-20240723-46ff151-NIGHTLY Bisect points to b7846c497b4dae18b7a2484fe5ea1acf55a16487
Minimized code
Output
Expectation
Should compile (probably)