✓
Passing This code compiles and runs correctly.
Code
// Test 604: Vertical Annotation Syntax
// Tests that vertical -bullet format produces same AST as inline |delimiter
const std = @import("std");
// Vertical with - bullets (markdown-strict: space after dash required)
~[
- comptime
- runtime
- fuseable
] tor vertical-bullets {}
// Vertical with parameterized annotations
~[
- optimize(level: 3)
- inline(threshold: 500)
- gpu(target: "metal", precision: "half")
] tor vertical-params {}
// Mix of simple and complex
~[
- comptime
- runtime
- optimize(level: 2)
- profile(sample_rate: 1000)
] tor vertical-mixed {}
// Should be equivalent to inline
~[comptime|runtime|fuseable] tor inline-equiv {}
~proc vertical-bullets|zig { return .{ .done = .{} }; }
~proc vertical-params|zig { return .{ .done = .{} }; }
~proc vertical-mixed|zig { return .{ .done = .{} }; }
~proc inline-equiv|zig { return .{ .done = .{} }; }
Supporting Files
#!/bin/bash
# Verify vertical annotation syntax produces correct AST
set -e
echo "Getting AST JSON..."
AST_JSON=$(koruc --ast-json input.kz 2>&1 | grep -A 999999 '^{')
echo ""
echo "Test 1: Vertical bullets produce annotations"
if echo "$AST_JSON" | grep -q '"comptime"'; then
echo "✓ Found 'comptime' from vertical"
else
echo "❌ Missing 'comptime' from vertical syntax"
exit 1
fi
if echo "$AST_JSON" | grep -q '"fuseable"'; then
echo "✓ Found 'fuseable' from vertical"
else
echo "❌ Missing 'fuseable' from vertical syntax"
exit 1
fi
echo ""
echo "Test 2: Vertical parameterized annotations (opaque strings)"
if echo "$AST_JSON" | grep -q '"optimize(level: 3)"'; then
echo "✓ Found 'optimize(level: 3)' as opaque string"
else
echo "❌ Missing 'optimize(level: 3)'"
exit 1
fi
if echo "$AST_JSON" | grep -q '"inline(threshold: 500)"'; then
echo "✓ Found 'inline(threshold: 500)' as opaque string"
else
echo "❌ Missing 'inline(threshold: 500)'"
exit 1
fi
if echo "$AST_JSON" | grep -q '"gpu(target: \"metal\", precision: \"half\")"' || \
echo "$AST_JSON" | grep -q 'gpu(target: "metal"'; then
echo "✓ Found complex 'gpu(...)' annotation"
else
echo "❌ Missing complex gpu annotation"
exit 1
fi
echo ""
echo "Test 3: Mixed simple and parameterized"
if echo "$AST_JSON" | grep -q '"profile(sample_rate: 1000)"'; then
echo "✓ Found 'profile(sample_rate: 1000)'"
else
echo "❌ Missing 'profile(sample_rate: 1000)'"
exit 1
fi
echo ""
echo "✅ All vertical annotation tests passed!"
echo ""
echo "NOTE: Vertical ~[-a -b] should produce SAME annotations as inline ~[a|b]"
Test Configuration
COMPILE_ONLY