mirror of
https://github.com/ziglang/zig.git
synced 2026-02-20 00:08:56 +00:00
parent
7f0620a20f
commit
ae61e26680
@ -4224,6 +4224,7 @@ static void define_builtin_types(CodeGen *g) {
|
||||
{
|
||||
TypeTableEntry *entry = new_type_table_entry(TypeTableEntryIdNullLit);
|
||||
buf_init_from_str(&entry->name, "(null)");
|
||||
entry->zero_bits = true;
|
||||
g->builtin_types.entry_null = entry;
|
||||
}
|
||||
{
|
||||
|
||||
@ -143,3 +143,8 @@ test "unwrap nullable which is field of global var" {
|
||||
unreachable;
|
||||
}
|
||||
}
|
||||
|
||||
test "null with default unwrap" {
|
||||
const x: i32 = null ?? 1;
|
||||
assert(x == 1);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user