Allow $typeof to return a compile time type.

This commit is contained in:
Christoffer Lerno
2025-07-01 00:02:12 +02:00
parent 8f86b331c1
commit 965ef19a5b
3 changed files with 46 additions and 12 deletions

View File

@@ -0,0 +1,23 @@
// #target: macos-x64
module test;
fn void main()
{
$switch $typeof({1, "hts"}):
$case String:
int x = 100;
$case $typeof({1, "kdejf"}):
int z = 2;
$default:
int y;
$endswitch
}
/* #expect: test.ll
define void @test.main() #0 {
entry:
%z = alloca i32, align 4
store i32 2, ptr %z, align 4
ret void
}