//! returns: 0 //! Test nested record function calls with scaling and addition. record Point: Copy { x: i32, y: i32, } fn add(p1: Point, p2: Point) -> Point { return Point { x: p1.x + p2.x, y: p1.y + p2.y }; } fn scale(p: Point, factor: i32) -> Point { return Point { x: p.x * factor, y: p.y * factor }; } @default fn main() -> i32 { let mut p: Point = Point { x: 3, y: 4 }; let mut q: Point = Point { x: 5, y: 6 }; set p = add( scale(p, 2), // (6, 8) scale(q, 2) // (10, 12) ); // (16, 20) // p.x + p.y = 16 + 20 = 36 assert p.x + p.y == 36; return 0; }