✓
Passing This code compiles and runs correctly.
Code
// Test: Annotations appear in AST JSON output
// Verifies that [annotation] syntax is parsed and stored in AST
const std = @import("std");
// Single annotation
~[comptime] tor compile-only {}
// Multiple annotations (inline with |)
~[comptime|runtime] tor dual-phase {}
// Multiple annotations (should also work - future vertical syntax)
~[fuseable] pub tor optimizable {}
// Proc with annotations
~[inline] proc compile-only|zig {
}
~proc dual-phase|zig {
}
~proc optimizable|zig {
}
Supporting Files
#!/bin/bash
# Verify that annotations appear in AST JSON
set -e
AST_JSON=$(koruc --ast-json input.kz 2>&1 | grep -A 999999 '^{')
echo "Checking for 'comptime' annotation..."
if echo "$AST_JSON" | grep -q '"comptime"'; then
echo "✓ Found 'comptime' annotation in AST"
else
echo "❌ 'comptime' annotation NOT found in AST"
exit 1
fi
echo "Checking for 'runtime' annotation..."
if echo "$AST_JSON" | grep -q '"runtime"'; then
echo "✓ Found 'runtime' annotation in AST"
else
echo "❌ 'runtime' annotation NOT found in AST"
exit 1
fi
echo "Checking for 'fuseable' annotation..."
if echo "$AST_JSON" | grep -q '"fuseable"'; then
echo "✓ Found 'fuseable' annotation in AST"
else
echo "❌ 'fuseable' annotation NOT found in AST"
exit 1
fi
echo "Checking for 'inline' annotation..."
if echo "$AST_JSON" | grep -q '"inline"'; then
echo "✓ Found 'inline' annotation in AST"
else
echo "❌ 'inline' annotation NOT found in AST"
exit 1
fi
echo ""
echo "✅ All annotations found in AST!"
Test Configuration
COMPILE_ONLY