Closed
Description
The following example triggers an infinite recursion in TypeAssigner.avoid(). The call to avoid() originates from ensureNoLocalRefs
, and, further up the call stack, from the handling of match
cases (Typer.scala:951). The actual avoidance is performed on a LazyRef
, which is likely at the heart of the problem.
trait FooBase {
type Bar >: Null <: BarBase { type This <: FooBase.this.Bar }
type This >: this.type <: FooBase { type This <: FooBase.this.This }
def derived(bar: Bar): This = ???
}
trait BarBase {
type This >: Null <: BarBase { type This <: BarBase.this.This }
}
object Test {
def bad(foo: FooBase): FooBase = foo match {
case foo: FooBase =>
foo.derived(???) // Triggers infinite loop in TypeAssigner.avoid()
}
}