Skip to content

pat-map RecursionOverflow when F-bounded type parameter involved #9841

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
Sciss opened this issue Sep 21, 2020 · 2 comments · Fixed by #9816
Closed

pat-map RecursionOverflow when F-bounded type parameter involved #9841

Sciss opened this issue Sep 21, 2020 · 2 comments · Fixed by #9816
Assignees
Milestone

Comments

@Sciss
Copy link
Contributor

Sciss commented Sep 21, 2020

Minimized code

trait Txn[T <: Txn[T]]

object Impl {
  sealed trait Entry[T <: Txn[T], A]
  case class EntrySingle[T <: Txn[T], A](term: Long, v: A)  extends Entry[T, A]
}

trait Impl[T <: Txn[T], K] {
  import Impl._

  def put[A](): Unit = {
    val opt: Option[Entry[T, A]] = ???
    
    opt match {
      case Some(EntrySingle(_, prevValue)) => ???   // crashes
      case _ =>
    }
  }
}

Output

Recursion limit exceeded.
Maybe there is an illegal cyclic reference?
If that's not the case, you could also try to increase the stacksize using the -Xss JVM option.
A recurring operation is (inner to outer):

  subtype LazyRef(uent / Compile / compileIncremental 3s
  de.sciss.lucre.confluent.Txn[
    LazyRef(
      de.sciss.lucre.confluent.Txn[
        LazyRef(
          de.sciss.lucre.confluent.Txn[
            LazyRef(

Expectation

Should work. Possibly related or the same underlying issue: #9631 , #9782

@Sciss
Copy link
Contributor Author

Sciss commented Sep 21, 2020

Here is another example:

trait Exec[T <: Exec[T]]

object Tree {
  sealed trait Next[+T, +PL, +P, +H, +A]

  sealed trait Child[+T, +PL, +P, +H, +A]

  sealed trait Branch[T <: Exec[T], PL, P, H, A] extends Child[T, PL, P, H, A] with NonEmpty[T, PL, P, H]

  sealed trait NonEmpty[T <: Exec[T], PL, P, H]

  case object Empty extends Next[Nothing, Nothing, Nothing, Nothing, Nothing]

  sealed trait RightBranch[T <: Exec[T], PL, P, H, A] extends Next[T, PL, P, H, A] with Branch[T, PL, P, H, A] 

  trait BranchImpl[T <: Exec[T], PL, P, H, A] {
    def next: Next[T, PL, P, H, A]

    def nextOption: Option[Branch[T, PL, P, H, A]] =
      next match {  // crashes
        case b: RightBranch[T, PL, P, H, A] => Some(b)
        case Empty                          => None
      }
  }
}

@liufengyun liufengyun self-assigned this Sep 21, 2020
liufengyun added a commit to dotty-staging/dotty that referenced this issue Sep 21, 2020
@liufengyun
Copy link
Contributor

This is fixed in #9816 (to be reviewed).

liufengyun added a commit to dotty-staging/dotty that referenced this issue Sep 24, 2020
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
Sciss added a commit to Sciss/HistoricalCode that referenced this issue Sep 1, 2023
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.

3 participants