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

Function contextual_struct_literals_in_array

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

Source from the content-addressed store, hash-verified

673 arr: i32[5] = [10, 20, 30, 40, 50]
674 sum: i32 = 0
675 for x in arr[1..4] {
676 sum = sum + x
677 }
678 return sum
679}
680"#,
681 90,
682 );
683}
684
685#[test]
686fn range_slice_of_slice() {
687 // Re-slicing a slice indexes relative to the sub-slice. view = {20,30,40},
688 // sub = view[1..3] = {30,40}. 30 + 40 = 70.
689 assert_exit(
690 r#"
691main: () -> i32 {
692 arr: i32[5] = [10, 20, 30, 40, 50]
693 view := arr[1..4]
694 sub := view[1..3]
695 return sub[0] + sub[1]
696}
697"#,
698 70,
699 );

Callers

nothing calls this directly

Calls 1

assert_exitFunction · 0.85

Tested by

no test coverage detected