1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
object test123 { type A = { def a: Int } def f(a: A): A = a } object structural2 { type A = { def a: Int } type B = { def b: Int } type AB = A & B def f(ab: AB): AB = ab f(new { def a = 43 def b = 42 }) }