Skip to content

Commit

Permalink
Add comptime.fn
Browse files Browse the repository at this point in the history
  • Loading branch information
cetio committed Apr 26, 2024
1 parent 0d9afd7 commit 3a67349
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions examples/comptime.fn
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module comptime;

alias afoo = 1 + 2;
alias[] abar = [afoo];

void foo([bool, bool] a = [true, true])()
{
abar ~= int;
abar ~= long;
writeln(a, " ", abar[0..2]);
}

void bar()
{
foo!([false, true])(); [false, true], 3, int
foo(); // [true, true], 3, int
(int, string) a = "abc";
assert(a is string);
assert(a == "abc");
afoo = a;
assert(afoo == "abc");
assert(abar[0] == 3);
}

0 comments on commit 3a67349

Please sign in to comment.