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

Assertion failed: "orphan parameter reference", inline transparent processing & given instances #15331

Closed
p-pavel opened this issue May 30, 2022 · 0 comments · Fixed by #15390

Comments

@p-pavel
Copy link

p-pavel commented May 30, 2022

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)

......
@p-pavel p-pavel added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label labels May 30, 2022
@nicolasstucki nicolasstucki added area:inline and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jun 1, 2022
odersky added a commit to dotty-staging/dotty that referenced this issue Jun 7, 2022
bishabosha pushed a commit to dotty-staging/dotty that referenced this issue Oct 18, 2022
@Kordyjan Kordyjan added this to the 3.2.0 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants