File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -4554,6 +4554,7 @@ static void define_builtin_types(CodeGen *g) {
45544554 {
45554555 TypeTableEntry *entry = new_type_table_entry (TypeTableEntryIdUndefLit);
45564556 buf_init_from_str (&entry->name , " (undefined)" );
4557+ entry->zero_bits = true ;
45574558 g->builtin_types .entry_undef = entry;
45584559 }
45594560 {
Original file line number Diff line number Diff line change 11const assert = @import ("std" ).debug .assert ;
2+ const mem = @import ("std" ).mem ;
23
34fn initStaticArray () - > [10 ]i32 {
45 var array : [10 ]i32 = undefined ;
@@ -60,3 +61,8 @@ test "assign undefined to struct with method" {
6061 assert (foo .x == 3 );
6162 }
6263}
64+
65+ test "type name of undefined" {
66+ const x = undefined ;
67+ assert (mem .eql (u8 , @typeName (@typeOf (x )), "(undefined)" ));
68+ }
You can’t perform that action at this time.
0 commit comments