✓
Passing This code compiles and runs correctly.
Code
// std/switch:char single-char dispatch. Two literal arms plus no-match;
// the first matching arm wins and binds the payload.
import std/switch
import std/io
std/switch:char('a')
| `a` _ |> std/io:print.ln("got-a")
| `b` _ |> std/io:print.ln("got-b")
| no-match |> std/io:print.ln("other")
Actual
got-a
Expected output
got-a
Test Configuration
MUST_RUN
Post-validation Script:
#!/bin/bash
# Verify std/switch:char lowers to a native Zig switch, not a regex DFA.
OUTPUT_FILE="output_emitted.zig"
if ! grep -qE "switch \(__koru_switch_value_[0-9]+_[0-9]+\)" "$OUTPUT_FILE"; then
echo "FAIL: expected 'switch (__koru_switch_value_...)' in emitted Zig"
exit 1
fi
echo "PASS: std/switch:char emits a Zig switch"
exit 0