From 61e7be109f07d208be05b0567c78427bb80f7686 Mon Sep 17 00:00:00 2001 From: Tom Grigg Date: Sat, 30 Jan 2021 16:28:46 -0800 Subject: [PATCH] Add regression test for #2941 --- tests/pos/i2941.scala | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/pos/i2941.scala 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() + } +}