Skip to content

Pickler crash when pickling retains annotation #20035

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

Closed
Linyxus opened this issue Mar 27, 2024 · 2 comments
Closed

Pickler crash when pickling retains annotation #20035

Linyxus opened this issue Mar 27, 2024 · 2 comments
Assignees

Comments

@Linyxus
Copy link
Contributor

Linyxus commented Mar 27, 2024

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)
@Linyxus Linyxus added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label labels Mar 27, 2024
@Linyxus Linyxus self-assigned this Mar 27, 2024
@Linyxus
Copy link
Contributor Author

Linyxus commented Mar 27, 2024

Another issue minimised from #19939

@Linyxus Linyxus added area:experimental:cc Capture checking related and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Mar 27, 2024
@Linyxus
Copy link
Contributor Author

Linyxus commented Mar 27, 2024

Note that #19846 and #18064 might be related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant