authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-05-03 12:42:09-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-06-10 20:40:03-07:00
logd1887ab1dde6b92e9cec374890d4c425b42ad376
treef6130f9e5439f3dbbd72fceafbe62d4d554af127
parentb125063dcfb95b470bc7830b188614361d3ba4cb

InternPool: implement hasRuntimeBitsAdvanced for simple_type


2 files changed, 52 insertions(+), 2 deletions(-)

src/Sema.zig+1
......@@ -32821,6 +32821,7 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value {
3282132821 .undefined => return Value.undef,
3282232822
3282332823 .generic_poison => return error.GenericPoison,
32824 .var_args_param => unreachable,
3282432825 },
3282532826 .struct_type => @panic("TODO"),
3282632827 .simple_value => unreachable,
src/type.zig+51-2
......@@ -2440,7 +2440,55 @@ pub const Type = struct {
24402440 .vector_type => @panic("TODO"),
24412441 .optional_type => @panic("TODO"),
24422442 .error_union_type => @panic("TODO"),
2443 .simple_type => @panic("TODO"),
2443 .simple_type => |t| return switch (t) {
2444 .f16,
2445 .f32,
2446 .f64,
2447 .f80,
2448 .f128,
2449 .usize,
2450 .isize,
2451 .c_char,
2452 .c_short,
2453 .c_ushort,
2454 .c_int,
2455 .c_uint,
2456 .c_long,
2457 .c_ulong,
2458 .c_longlong,
2459 .c_ulonglong,
2460 .c_longdouble,
2461 .bool,
2462 .anyerror,
2463 .@"anyframe",
2464 .anyopaque,
2465 .atomic_order,
2466 .atomic_rmw_op,
2467 .calling_convention,
2468 .address_space,
2469 .float_mode,
2470 .reduce_op,
2471 .call_modifier,
2472 .prefetch_options,
2473 .export_options,
2474 .extern_options,
2475 => true,
2476
2477 // These are false because they are comptime-only types.
2478 .void,
2479 .type,
2480 .comptime_int,
2481 .comptime_float,
2482 .noreturn,
2483 .null,
2484 .undefined,
2485 .enum_literal,
2486 .type_info,
2487 => false,
2488
2489 .generic_poison => unreachable,
2490 .var_args_param => unreachable,
2491 },
24442492 .struct_type => @panic("TODO"),
24452493 .simple_value => unreachable,
24462494 .extern_func => unreachable,
......@@ -2500,7 +2548,6 @@ pub const Type = struct {
25002548 .@"anyframe",
25012549 .anyopaque,
25022550 .@"opaque",
2503 .type_info,
25042551 .error_set_single,
25052552 .error_union,
25062553 .error_set,
......@@ -2545,6 +2592,7 @@ pub const Type = struct {
25452592 .enum_literal,
25462593 .empty_struct,
25472594 .empty_struct_literal,
2595 .type_info,
25482596 // These are function *bodies*, not pointers.
25492597 // Special exceptions have to be made when emitting functions due to
25502598 // this returning false.
......@@ -5075,6 +5123,7 @@ pub const Type = struct {
50755123 .undefined => return Value.undef,
50765124
50775125 .generic_poison => unreachable,
5126 .var_args_param => unreachable,
50785127 },
50795128 .struct_type => @panic("TODO"),
50805129 .simple_value => unreachable,