From 461742baf8e264ab5177b99f7a16cc8fb1fe2247 Mon Sep 17 00:00:00 2001 From: Hamza Remmal Date: Thu, 4 Dec 2025 01:25:07 +0100 Subject: [PATCH] chore: add a regression test for #15786 --- tests/pos/i15786.scala | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/pos/i15786.scala diff --git a/tests/pos/i15786.scala b/tests/pos/i15786.scala new file mode 100644 index 000000000000..8c9b605d9c3d --- /dev/null +++ b/tests/pos/i15786.scala @@ -0,0 +1,15 @@ +class A(val f: () => Int) { + def mA(p: Int = 0): Int = p +} + +trait B { + def mB(p1: Int): Unit +} + +class C[T](val f1: B, val f2: T) + +val f = new A(() => { + val x: B = null + C[Int](x, 0).f1.mB(1); + 1 +}).mA()