MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / result_try_propagates_error

Function result_try_propagates_error

tests/integration/hll_conformance.rs:1582–1609  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1580 );
1581}
1582
1583// --- Methods (`impl` blocks) and interfaces (spec 6.2 / 6.5) ---
1584
1585#[test]
1586fn impl_method_static_dispatch_executes() {
1587 // `r.area()` and a method calling another method through `self` both
1588 // dispatch statically and run to the right values.
1589 assert_exit(
1590 r#"
1591struct Rect { width: i32, height: i32 }
1592impl Rect {
1593 area: (self: Rect*) -> i32 { return self.width * self.height }
1594 scaled_area: (self: Rect*, k: i32) -> i32 { return self.area() * k }
1595}
1596main: () -> i32 {
1597 r: Rect = Rect { .width = 6, .height = 7 }
1598 if r.area() != 42 { return 1 }
1599 if r.scaled_area(3) != 126 { return 2 }
1600 p: Rect* = &r
1601 if p.area() != 42 { return 3 }
1602 return 0
1603}
1604"#,
1605 0,
1606 );
1607}
1608
1609#[test]
1610fn generic_bound_method_call_executes() {
1611 // A bounded generic specializes per concrete type; `v.describe()` resolves
1612 // to each type's own method after substitution.

Callers

nothing calls this directly

Calls 1

assert_exitFunction · 0.85

Tested by

no test coverage detected