Duplicate symbols with static variable declared in macro #1248. Improved error message when trying user foreach with an untyped list.

This commit is contained in:
Christoffer Lerno
2024-07-20 03:39:33 +02:00
parent b25c573ae3
commit 03cfa42eb6
4 changed files with 88 additions and 3 deletions

View File

@@ -0,0 +1,76 @@
// #target: macos-x64
module test;
import asdf;
import foo;
import std::io;
fn int main(String[] args) {
bar();
bar2();
foo::bar();
foo::bar2();
return 0;
}
fn void bar() {
asdf::get_static();
}
fn void* bar2() {
return asdf::get_static_ref();
}
module foo;
import asdf;
import std::io;
// Same function name
fn void bar() {
asdf::get_static();
}
fn void* bar2() {
return asdf::get_static_ref();
}
module asdf;
macro get_static() {
static char x;
return x;
}
macro get_static_ref() {
static char x;
return &x;
}
/* #expect: foo.ll
@bar.x = internal local_unnamed_addr global i8 0, align 1
@bar2.x = internal global i8 0, align 1
define void @foo.bar() #0 {
entry:
ret void
}
define ptr @foo.bar2() #0 {
entry:
ret ptr @bar2.x
}
// #expect: test.ll
@bar.x = internal local_unnamed_addr global i8 0, align 1
@bar2.x = internal global i8 0, align 1
define void @test.bar() #0 {
entry:
ret void
}
define ptr @test.bar2() #0 {
entry:
ret ptr @bar2.x
}