// #target: macos-x64
module mymodule;

extern fn void printf(char *, ...);

struct Foo { int y; }

int b;

fn void main()
{
    printf("%s\n", Foo.qnameof);
    printf("%s\n", $typefrom("Foo").qnameof);
    printf("%s\n", Foo.nameof);
    printf("%s\n", $typefrom("mymodule::Foo").nameof);
    printf("%s\n", Foo.extnameof);
    printf("%s\n", $typefrom("Foo").extnameof);

    printf("%s\n", $qnameof(b));
    printf("%s\n", $qnameof($eval("b")));
    printf("%s\n", $nameof(b));
    printf("%s\n", $nameof($eval("mymodule::b")));
    printf("%s\n", $extnameof(b));
    printf("%s\n", $extnameof($eval("b")));

    int a;

    printf("%s\n", $qnameof(a));
    printf("%s\n", $qnameof($eval("a")));
    printf("%s\n", $nameof(a));
    printf("%s\n", $nameof($eval("a")));

}

/* #expect: mymodule.ll

@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.1 = private unnamed_addr constant [14 x i8] c"mymodule::Foo\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.3 = private unnamed_addr constant [14 x i8] c"mymodule::Foo\00", align 1
@.str.4 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.5 = private unnamed_addr constant [4 x i8] c"Foo\00", align 1
@.str.6 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.7 = private unnamed_addr constant [4 x i8] c"Foo\00", align 1
@.str.8 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.9 = private unnamed_addr constant [13 x i8] c"mymodule.Foo\00", align 1
@.str.10 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.11 = private unnamed_addr constant [13 x i8] c"mymodule.Foo\00", align 1
@.str.12 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.13 = private unnamed_addr constant [12 x i8] c"mymodule::b\00", align 1
@.str.14 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.15 = private unnamed_addr constant [12 x i8] c"mymodule::b\00", align 1
@.str.16 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.17 = private unnamed_addr constant [2 x i8] c"b\00", align 1
@.str.18 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.19 = private unnamed_addr constant [2 x i8] c"b\00", align 1
@.str.20 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.21 = private unnamed_addr constant [11 x i8] c"mymodule.b\00", align 1
@.str.22 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.23 = private unnamed_addr constant [11 x i8] c"mymodule.b\00", align 1
@.str.24 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.25 = private unnamed_addr constant [2 x i8] c"a\00", align 1
@.str.26 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.27 = private unnamed_addr constant [2 x i8] c"a\00", align 1
@.str.28 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.29 = private unnamed_addr constant [2 x i8] c"a\00", align 1
@.str.30 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
@.str.31 = private unnamed_addr constant [2 x i8] c"a\00", align 1