Minimized code
class A(val i: Int)
def a(i: Int): A = new A(i) { println(i) }
Output
Reference to i is ambiguous,
it is both defined in method a
and inherited subsequently in anonymous class A {...}
Expectation
The code compiles in both dotty 0.23 and scala 2.3.1