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 {...@@ -32821,6 +32821,7 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value {
32821 .undefined => return Value.undef,32821 .undefined => return Value.undef,
3282232822
32823 .generic_poison => return error.GenericPoison,32823 .generic_poison => return error.GenericPoison,
32824 .var_args_param => unreachable,
32824 },32825 },
32825 .struct_type => @panic("TODO"),32826 .struct_type => @panic("TODO"),
32826 .simple_value => unreachable,32827 .simple_value => unreachable,
src/type.zig+51-2
...@@ -2440,7 +2440,55 @@ pub const Type = struct {...@@ -2440,7 +2440,55 @@ pub const Type = struct {
2440 .vector_type => @panic("TODO"),2440 .vector_type => @panic("TODO"),
2441 .optional_type => @panic("TODO"),2441 .optional_type => @panic("TODO"),
2442 .error_union_type => @panic("TODO"),2442 .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 },
2444 .struct_type => @panic("TODO"),2492 .struct_type => @panic("TODO"),
2445 .simple_value => unreachable,2493 .simple_value => unreachable,
2446 .extern_func => unreachable,2494 .extern_func => unreachable,
...@@ -2500,7 +2548,6 @@ pub const Type = struct {...@@ -2500,7 +2548,6 @@ pub const Type = struct {
2500 .@"anyframe",2548 .@"anyframe",
2501 .anyopaque,2549 .anyopaque,
2502 .@"opaque",2550 .@"opaque",
2503 .type_info,
2504 .error_set_single,2551 .error_set_single,
2505 .error_union,2552 .error_union,
2506 .error_set,2553 .error_set,
...@@ -2545,6 +2592,7 @@ pub const Type = struct {...@@ -2545,6 +2592,7 @@ pub const Type = struct {
2545 .enum_literal,2592 .enum_literal,
2546 .empty_struct,2593 .empty_struct,
2547 .empty_struct_literal,2594 .empty_struct_literal,
2595 .type_info,
2548 // These are function *bodies*, not pointers.2596 // These are function *bodies*, not pointers.
2549 // Special exceptions have to be made when emitting functions due to2597 // Special exceptions have to be made when emitting functions due to
2550 // this returning false.2598 // this returning false.
...@@ -5075,6 +5123,7 @@ pub const Type = struct {...@@ -5075,6 +5123,7 @@ pub const Type = struct {
5075 .undefined => return Value.undef,5123 .undefined => return Value.undef,
50765124
5077 .generic_poison => unreachable,5125 .generic_poison => unreachable,
5126 .var_args_param => unreachable,
5078 },5127 },
5079 .struct_type => @panic("TODO"),5128 .struct_type => @panic("TODO"),
5080 .simple_value => unreachable,5129 .simple_value => unreachable,