Closed
Description
Compiler version
3.1.2
Minimized code
trait Composable[A,B]:
def compose(a: A, b: B): Any
trait Arrow {type Dom; type Codom}
given composeArrows[A, Arr1 <: Arrow, Arr2 <: Arrow]: Composable[Arr1 {type Dom = A}, Arr2 {type Codom = A}] with
def compose(a: Arr1 {type Dom = A}, b: Arr2 {type Codom = A}): Arrow {type Dom = b.Dom; type Codom = a.Codom} = ???
object arr1 extends Arrow { type Dom = Int; type Codom = Int}
object arr2 extends Arrow {type Dom = Int; type Codom = Float}
// removing "transparent" alleviates the situation
inline transparent def compose[A, B](a: A, b: B)(using c: Composable[A,B]) = c.compose(a,b)
val c = compose(arr2,arr1)
Output
scalac: Error: assertion failed: orphan parameter reference: TermParamRef(b)
java.lang.AssertionError: assertion failed: orphan parameter reference: TermParamRef(b)
at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
at dotty.tools.dotc.core.tasty.TreePickler.pickleNewType(TreePickler.scala:286)
at dotty.tools.dotc.core.tasty.TreePickler.pickleType(TreePickler.scala:155)
at dotty.tools.dotc.core.tasty.TreePickler.pickleNewType(TreePickler.scala:215)
......