diff --git a/tests/pos/i2941.scala b/tests/pos/i2941.scala new file mode 100644 index 000000000000..83d58d2c35f2 --- /dev/null +++ b/tests/pos/i2941.scala @@ -0,0 +1,17 @@ +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() + } +}