| 1434 | fn call_return_value_used_in_expr() { |
| 1435 | let (_, outcome, _) = run_hll( |
| 1436 | r#" |
| 1437 | double: (n: i32) -> i32 { |
| 1438 | return n * 2 |
| 1439 | } |
| 1440 | main: () -> i32 { |
| 1441 | result: i32 = double(21) |
| 1442 | check: i32 = result - 42 |
| 1443 | if check == 0 { |
| 1444 | return 0 |
| 1445 | } |
| 1446 | return 1 |
| 1447 | } |
| 1448 | "#, |
| 1449 | ); |
| 1450 | assert!( |
| 1451 | matches!(outcome, RunOutcome::Halted(0)), |
| 1452 | "double(21) = 42, used in expression, got {outcome:?}" |
| 1453 | ); |
| 1454 | } |
| 1455 | |
| 1456 | // --- emit_li constant materialization (merged from emit_li_execution.rs) --- |
| 1457 | // Expected values are built from safe (<= 2047) operands so the comparison |
| 1458 | // target is not affected by the same bug under test. |