- Add lenof() compile time function #2439

- Fix release notes
This commit is contained in:
Christoffer Lerno
2025-09-06 18:17:17 +02:00
parent bd9bc118db
commit 3eb8f68ded
9 changed files with 88 additions and 6 deletions

View File

@@ -0,0 +1,20 @@
module regression;
import std;
fn void lenof_test() @test
{
List{int} l;
l.push(123);
l.push(222);
l.push(111);
test::eq(lenof(l), 3);
int[] x = { 1, 2 };
test::eq(lenof(x), 2);
l.push(111);
test::eq(lenof(l), 4);
assert(!$defined(lenof(1)));
assert($defined(lenof(x)));
int* zz;
assert(!$defined(lenof(zz)));
}