Update to fix with splat.

This commit is contained in:
Christoffer Lerno
2025-10-20 02:26:04 +02:00
parent 6169d7acdf
commit a81f857d8c
7 changed files with 126 additions and 8 deletions

View File

@@ -0,0 +1,62 @@
import std;
fn int test1()
{
@test1();
}
fn int test2()
{
@test2();
}
fn int test3()
{
@test3();
}
fn int test4()
{
@test4();
}
fn void test5()
{
@test5();
}
fn void test6()
{
@test6();
}
macro @test1($Foo = ...)
{
return $Foo.typeid; // #error: The parameter '$Foo' was not provided by the caller.
}
macro @test2(#foo = ...)
{
return #foo; // #error: The parameter '#foo' was not provided by the caller
}
macro @test3(foo = ...)
{
return foo; // #error: The parameter 'foo' was not provided by the caller.
}
macro @test4($foo = ...)
{
return $foo; // #error: The parameter '$foo' was not provided by the caller
}
macro @test5($Foo = ...)
{
$Foo = int; // #error: The parameter '$Foo' was not provided by the caller
return $Foo.typeid;
}
macro @test6(foo = ...)
{
foo = 1; // #error: The parameter 'foo' was not provided by the caller
return foo;
}

View File

@@ -0,0 +1,30 @@
// #target: macos-x64
module test;
import std;
fn int main()
{
bool x = test1a()();
return 0;
}
macro test1a(bool $a = ...) => fn bool()
{
return test1b(...$a);
};
macro test1b(bool $a = ...) => $defined($a) ??? $a : false;
/* #expect: test.ll
entry:
%x = alloca i8, align 1
%0 = call i8 @"test.test1a$lambda1"()
store i8 %0, ptr %x, align 1
ret i32 0
}
; Function Attrs: nounwind uwtable
define internal zeroext i8 @"test.test1a$lambda1"() #0 {
entry:
ret i8 0
}