Skip to content

Pickler crash when pickling retains annotation #20035

Closed
@Linyxus

Description

@Linyxus

Compiler version

main

Minimized code

import language.experimental.captureChecking

trait Seq[+A]:
  def zipAll[A1 >: A, B](that: Seq[B]^, thisElem: A1, thatElem: B): Seq[(A1, B)]^{this, that}
  def map[B](f: A => B): Seq[B]^{this, f}

def zipAllOption[X](left: Seq[X], right: Seq[X]) =
  left.map(Option(_)).zipAll(right.map(Option(_)), None, None)

def fillRow[T](headRow: Seq[T], tailRow: Seq[T]) =
  val paddedZip = zipAllOption(headRow, tailRow)

Output

error when pickling type X
error when pickling type Option[X]
error when pickling type Seq[Option[X]]
error when pickling type Seq[Option[X]]^{this, X -> Option[X]}
error when pickling tree Seq[Option[X]]^{this, X -> Option[X]}
error when pickling tree null.$asInstanceOf[Seq[Option[X]]^{this, X -> Option[X]}]
error when pickling tree this
error when pickling tree [this,that : Any]
error when pickling tree [this,that : Any]*
error when pickling tree new _root_.scala.annotation.retains([this,that : Any]*)
error when pickling type Seq[(Option[T], Option[T])]^{this, Seq[Option[X]]^{this, X -> Option[X]}}
error when pickling tree Seq[(Option[T], Option[T])]^{this, Seq[Option[X]]^{this, X -> Option[X]}}
error when pickling tree val paddedZip: Seq[(Option[T], Option[T])]^{this, Seq[Option[X]]^{this, X -> Option[X]}} = zipAllOption[T](headRow, tailRow)
error when pickling tree {
  val paddedZip: Seq[(Option[T], Option[T])]^{this, Seq[Option[X]]^{this, X -> Option[X]}} = zipAllOption[T](headRow, tailRow)
  ()
}
...
Exception in thread "main" java.lang.AssertionError: assertion failed: orphan parameter reference: TypeParamRef(X)
	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleNewType(TreePickler.scala:295)
	at dotty.tools.dotc.core.tasty.TreePickler.pickleType(TreePickler.scala:165)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions