✓
Passing This code compiles and runs correctly.
Code
// Test 605: Annotation Edge Cases
// Tests various annotation formats to verify opaque string storage
const std = @import("std");
// Annotations with special characters (opaque!)
~[gpu:metal:half] tor colon-separated {}
// Annotations with comparison operators
~[version>=2.0] tor version-check {}
// Annotations with spaces in params
~[profile "with spaces" 1000Hz] tor spaced {}
// Nested parens (opaque string handles it)
~[custom(foo(bar: 1))] tor nested {}
// URL-like annotation
~[source("https://example.com/spec")] tor url-annot {}
// Future syntax experimentation
~[inline@500] tor at-syntax {}
~proc colon-separated|zig { return .{ .done = .{} }; }
~proc version-check|zig { return .{ .done = .{} }; }
~proc spaced|zig { return .{ .done = .{} }; }
~proc nested|zig { return .{ .done = .{} }; }
~proc url-annot|zig { return .{ .done = .{} }; }
~proc at-syntax|zig { return .{ .done = .{} }; }
Supporting Files
#!/bin/bash
# Verify that weird/experimental annotation formats are stored as opaque strings
set -e
echo "Getting AST JSON..."
AST_JSON=$(koruc --ast-json input.kz 2>&1 | grep -A 999999 '^{')
echo ""
echo "Test 1: Colon-separated annotation"
if echo "$AST_JSON" | grep -q 'gpu:metal:half'; then
echo "✓ Found 'gpu:metal:half' - colon format preserved"
else
echo "❌ Colon-separated annotation lost"
exit 1
fi
echo ""
echo "Test 2: Comparison operators"
if echo "$AST_JSON" | grep -q 'version>=2.0'; then
echo "✓ Found 'version>=2.0' - operators preserved"
else
echo "❌ Comparison operator annotation lost"
exit 1
fi
echo ""
echo "Test 3: At-sign syntax"
if echo "$AST_JSON" | grep -q 'inline@500'; then
echo "✓ Found 'inline@500' - at-sign format preserved"
else
echo "❌ At-sign annotation lost"
exit 1
fi
echo ""
echo "Test 4: URL in annotation"
if echo "$AST_JSON" | grep -q 'https://example.com'; then
echo "✓ Found URL - complex strings preserved"
else
echo "❌ URL annotation lost"
exit 1
fi
echo ""
echo "✅ All edge case tests passed!"
echo ""
echo "KEY INSIGHT: Annotations are OPAQUE STRINGS"
echo "Parser doesn't parse inside them - compile-time code does!"
Test Configuration
COMPILE_ONLY