Skip to content

recursive type member cause assertion failure #12731

Closed
@xuwei-k

Description

@xuwei-k

Compiler version

3.0.2-RC1-bin-20210605-f1252d8-NIGHTLY, 3.0.1-RC1, 3.0.0

Minimized code

trait A {
  type B <: A {
    type B <: A.this.B
  }

  def c: B
}

object Main {
  def x: A = null

  def main(args: Array[String]): Unit = {
    x.c.c.c
  }
}

Output (click arrow to expand)

[info] compiling 1 Scala source to /Users/kenji/recursion-type-member-scala-3/target/scala-3.0.2-RC1-bin-20210605-f1252d8-NIGHTLY/classes ...
[info] assertion failure [[cannot display since dotty.tools.dotc.core.CyclicReference:  was thrown]]
[info] assertion failure [[cannot display since dotty.tools.dotc.core.CyclicReference:  was thrown]]
[info] assertion failure [[cannot display since dotty.tools.dotc.core.CyclicReference:  was thrown]]
[info] assertion failure for type bounds [... (caught cyclic reference) ...] <:< type bounds [ <: A{B <: (A{B <: A#B#B} & A#B)#B} & A#B], frozen = true
[info] assertion failure [[cannot display since dotty.tools.dotc.core.CyclicReference:  was thrown]]
[info] assertion failure for A{B <: A#B#B} & A#B <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A#B#B <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A#B#B <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A{B <: A#B#B} <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A{B <: A#B#B} & A#B <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A#B#B <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A#B#B <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A{B <: A#B#B} <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A{B <: A#B#B} & A#B <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A#B#B <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A#B#B <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A{B <: A#B#B} <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A{B <: A#B#B} & A#B <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A#B#B <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A#B#B <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A{B <: A#B#B} <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A{B <: A#B#B} & A#B <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A#B#B <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A#B#B <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A{B <: A#B#B} <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A{B <: A#B#B} & A#B <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A#B#B <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure for A#B#B <:< A{B <: A{B <: A#B#B}#B}, frozen = true
[info] assertion failure [[cannot display since dotty.tools.dotc.core.CyclicReference:  was thrown]]
[info] assertion failure [[cannot display since dotty.tools.dotc.core.CyclicReference:  was thrown]]
[info] assertion failure [[cannot display since dotty.tools.dotc.core.CyclicReference:  was thrown]]
[info] assertion failure for type bounds [... (caught cyclic reference) ...] <:< type bounds [ <: A{B <: (A{B <: A#B#B} & A#B)#B} & A#B], frozen = true
[info] assertion failure [[cannot display since dotty.tools.dotc.core.CyclicReference:  was thrown]]
[info] assertion failure [[cannot display since dotty.tools.dotc.core.CyclicReference:  was thrown]]
[info] assertion failure [[cannot display since dotty.tools.dotc.core.CyclicReference:  was thrown]]
[info] assertion failure [[cannot display since dotty.tools.dotc.core.CyclicReference:  was thrown]]
[info] assertion failure [[cannot display since dotty.tools.dotc.core.CyclicReference:  was thrown]]
[info] assertion failure [[cannot display since dotty.tools.dotc.core.CyclicReference:  was thrown]]
[info] assertion failure [[cannot display since dotty.tools.dotc.core.CyclicReference:  was thrown]]
[info] assertion failure [[cannot display since dotty.tools.dotc.core.CyclicReference:  was thrown]]
[info] assertion failure [[cannot display since dotty.tools.dotc.core.CyclicReference:  was thrown]]
[info] assertion failure [[cannot display since dotty.tools.dotc.core.CyclicReference:  was thrown]]
[info] assertion failure [[cannot display since dotty.tools.dotc.core.CyclicReference:  was thrown]]
[info] assertion failure [[cannot display since java.lang.AssertionError: assertion failed was thrown]]
[info] assertion failure [[cannot display since dotty.tools.dotc.core.CyclicReference:  was thrown]]
[info] assertion failure [[cannot display since dotty.tools.dotc.core.CyclicReference:  was thrown]]
[info] assertion failure [[cannot display since dotty.tools.dotc.core.CyclicReference:  was thrown]]
[error] -- Error: /Users/kenji/recursion-type-member-scala-3/A.scala:13:8 --------------
[error] 13 |    x.c.c.c
[error]    |        ^
[error]    |Recursion limit exceeded.
[error]    |Maybe there is an illegal cyclic reference?
[error]    |If that's not the case, you could also try to increase the stacksize using the -Xss JVM option.
[error]    |A recurring operation is (inner to outer):
[error]    |
[error]    |  subtype ... (caught cyclic reference) ... <:< ... (caught cyclic reference) ...
[error]    |  subtype ... (caught cyclic reference) ... <:< ... (caught cyclic reference) ...
[error]    |  subtype ... (caught cyclic reference) ... <:< ... (caught cyclic reference) ...
[error]    |  subtype ... (caught cyclic reference) ... <:< ... (caught cyclic reference) ...
[error]    |  subtype ... (caught cyclic reference) ... <:< ... (caught cyclic reference) ...
[error]    |  subtype ... (caught cyclic reference) ... <:< ... (caught cyclic reference) ...
[error]    |  subtype ... (caught cyclic reference) ... <:< ... (caught cyclic reference) ...
[error]    |  subtype ... (caught cyclic reference) ... <:< ... (caught cyclic reference) ...
[error]    |  subtype ... (caught cyclic reference) ... <:< ... (caught cyclic reference) ...
[error]    |  subtype ... (caught cyclic reference) ... <:< ... (caught cyclic reference) ...
[error]    |  ...
[error]    |
[error]    |  subtype A#B#B <:< A{B <: A{B <: A#B#B}#B}
[error]    |  subtype A{B <: A#B#B} & A#B <:< A{B <: A{B <: A#B#B}#B}
[error]    |  subtype A#B#B <:< A{B <: A{B <: A#B#B}#B}
[error]    |  subtype A{B <: A#B#B} & A#B <:< A{B <: A{B <: A#B#B}#B}
[error]    |  subtype A#B#B <:< A{B <: A{B <: A#B#B}#B}
[error]    |  subtype A{B <: A#B#B} & A#B <:< A{B <: A{B <: A#B#B}#B}
[error]    |  subtype A#B#B <:< A{B <: A{B <: A#B#B}#B}
[error]    |  subtype A{B <: A#B#B} & A#B <:< [cannot display due to assertion failed, raw string = RefinedType(TypeRef(ThisType(TypeRef(NoPrefix,module class <empty>)),trait A),B,TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing),LazyRef(null)))]
[error]    |  subtype A#B#B <:< ... (caught cyclic reference) ...
[error]    |  subtype (A#B#c : => A#B#B) <:< ?{ c: ? }
[error] one error found

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions