Skip to content

Commit c9309e7

Browse files
authored
chore: add a regression test for #15786 (#24658)
- Code is legit and should work. - The error was indeed present in `3.1.3` and not present anymore: ```scala exception occurred while compiling test.scala java.lang.AssertionError: assertion failed: method $anonfun while compiling test.scala Exception in thread "main" java.lang.AssertionError: assertion failed: method $anonfun at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8) at dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:324) at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:559) at dotty.tools.dotc.core.tasty.TreePickler.pickleTree$$anonfun$9$$anonfun$1(TreePickler.scala:468) ``` Closes #15786
1 parent 051848e commit c9309e7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/pos/i15786.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class A(val f: () => Int) {
2+
def mA(p: Int = 0): Int = p
3+
}
4+
5+
trait B {
6+
def mB(p1: Int): Unit
7+
}
8+
9+
class C[T](val f1: B, val f2: T)
10+
11+
val f = new A(() => {
12+
val x: B = null
13+
C[Int](x, 0).f1.mB(1);
14+
1
15+
}).mA()

0 commit comments

Comments
 (0)