scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
232 stars 21 forks source link

Infinite recursion in RefChecks #13013

Closed lrytz closed 4 months ago

lrytz commented 4 months ago
object Node {
  trait Root { self: Node =>
    val root = this
  }
}
trait Node {
  def root: Node
}
final class RootNode extends Node with Node.Root

Compiles on 2.12, crashes in RefChecks on 2.13.14

    at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.checkOverrideTerm$1(RefChecks.scala:557)
    at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.checkOverrideTypes$1(RefChecks.scala:565)
    at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.checkOverride$1(RefChecks.scala:393)
    at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.checkAllOverrides(RefChecks.scala:582)
    at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.checkOverrideTerm$1(RefChecks.scala:557)
    at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.checkOverrideTypes$1(RefChecks.scala:565)
    at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.checkOverride$1(RefChecks.scala:393)
    at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.checkAllOverrides(RefChecks.scala:582)
    at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.checkOverrideTerm$1(RefChecks.scala:557)