Skip to content

Recursion limit exceeded (on union type) #11223

Closed
@rskfocus

Description

@rskfocus

Compiler version

3.0.0-M3

Minimized code

object T extends App:
  trait M[F[_]]
  trait EE[A, B]
  trait AE[A]
  trait DE[A]
  trait CE[A]

  type A1 = M[AE]
  type D1 = M[DE] | M[[a] =>> EE[Int, a]]
  type C1 = M[CE]

  trait F[+R, +A]:
    def <+>[U, B](b: F[U, B]): F[R | U, A] = null
    def int: F[R | A1, Int]

  def d1[A](f: => A): F[D1, A] = null
  def m[R, A](f: F[R | C1, A]): F[R | C1, A] = null

  def x = m { // adding type annotation here helps (m[D1 | A1 | C1, Int])
    d1(123).int <+> null
  }

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 [X0] >: T.DE[X0] & T.EE[Int, X0] <: T.DE[X0] | T.EE[Int, X0] <:< T.AE

Expectation

Type is inferred by compiler or (at least) meaningful error is given.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:typerbacklogNo work planned on this by the core team for the time being.itype:bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions