Files
c3c/test/test_suite/compile_time/ct_assert_bug.c3
Christoffer Lerno 2439405e70 - $foreach "()" replaced by trailing ":" $foreach ($x, $y : $foo) -> $foreach $x, $y : $foo:
- `$for` "()" replaced by trailing ":" `$for (var $x = 0; $x < FOO; $x++)` -> `$for var $x = 0; $x < FOO; $x++:`
- `$switch` "()" replaced by trailing ":" `$switch ($Type)` -> `$switch $Type:`
- Empty `$switch` requires trailing ":" `$switch` -> `$switch:`
2025-03-04 16:13:47 +01:00

25 lines
501 B
Plaintext

// #target: macos-x64
module testing;
import std::io;
fn void main()
{
String[] s1;
String[] s2;
deep_equal(s1, s2);
}
macro bool deep_equal(a, b)
{
$switch $typeof(a).kindof:
$case SLICE:
if (a.len != b.len) return false;
foreach (i, x : a)
{
if (!deep_equal(x, b[i])) return false;
}
return true;
$default:
$assert(false); // #error: Compile time assert failed
$endswitch
}