()
| 604 | // A runtime index that is in bounds passes the check and reads the element. |
| 605 | assert_exit( |
| 606 | r#" |
| 607 | main: () -> i32 { |
| 608 | arr: i32[3] = [10, 20, 30] |
| 609 | view: i32[] = arr |
| 610 | i: i32 = 2 |
| 611 | return view[i] |
| 612 | } |
| 613 | "#, |
| 614 | 30, |
| 615 | ); |
| 616 | } |
| 617 | |
| 618 | // --- Range slicing (arr[a..b]) --- |
| 619 | |
| 620 | #[test] |
| 621 | fn range_slice_from_array() { |
| 622 | // arr[1..4] is the half-open sub-slice {20, 30, 40}. 20 + 40 + 3 = 63. |
| 623 | assert_exit( |
| 624 | r#" |
nothing calls this directly
no test coverage detected