stage2: LLVM backend: implement wrap_optional AIR

and move over some passing tests
This commit is contained in:
Andrew Kelley
2021-10-14 22:16:26 -07:00
parent 55eea3b045
commit cacd5366a6
11 changed files with 428 additions and 402 deletions

View File

@@ -411,3 +411,38 @@ test "use of declaration with same name as primitive" {
const c: @"u8" = 300;
try expect(c == 300);
}
fn emptyFn() void {}
test "constant equal function pointers" {
const alias = emptyFn;
try expect(comptime x: {
break :x emptyFn == alias;
});
}
test "multiline string literal is null terminated" {
const s1 =
\\one
\\two)
\\three
;
const s2 = "one\ntwo)\nthree";
try expect(std.cstr.cmp(s1, s2) == 0);
}
test "self reference through fn ptr field" {
const S = struct {
const A = struct {
f: fn (A) u8,
};
fn foo(a: A) u8 {
_ = a;
return 12;
}
};
var a: S.A = undefined;
a.f = S.foo;
try expect(a.f(a) == 12);
}