InternPool: implement hasRuntimeBitsAdvanced for simple_type

This commit is contained in:
Andrew Kelley
2023-05-03 12:42:09 -07:00
parent b125063dcf
commit d1887ab1dd
2 changed files with 52 additions and 2 deletions

View File

@@ -32821,6 +32821,7 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value {
.undefined => return Value.undef,
.generic_poison => return error.GenericPoison,
.var_args_param => unreachable,
},
.struct_type => @panic("TODO"),
.simple_value => unreachable,

View File

@@ -2440,7 +2440,55 @@ pub const Type = struct {
.vector_type => @panic("TODO"),
.optional_type => @panic("TODO"),
.error_union_type => @panic("TODO"),
.simple_type => @panic("TODO"),
.simple_type => |t| return switch (t) {
.f16,
.f32,
.f64,
.f80,
.f128,
.usize,
.isize,
.c_char,
.c_short,
.c_ushort,
.c_int,
.c_uint,
.c_long,
.c_ulong,
.c_longlong,
.c_ulonglong,
.c_longdouble,
.bool,
.anyerror,
.@"anyframe",
.anyopaque,
.atomic_order,
.atomic_rmw_op,
.calling_convention,
.address_space,
.float_mode,
.reduce_op,
.call_modifier,
.prefetch_options,
.export_options,
.extern_options,
=> true,
// These are false because they are comptime-only types.
.void,
.type,
.comptime_int,
.comptime_float,
.noreturn,
.null,
.undefined,
.enum_literal,
.type_info,
=> false,
.generic_poison => unreachable,
.var_args_param => unreachable,
},
.struct_type => @panic("TODO"),
.simple_value => unreachable,
.extern_func => unreachable,
@@ -2500,7 +2548,6 @@ pub const Type = struct {
.@"anyframe",
.anyopaque,
.@"opaque",
.type_info,
.error_set_single,
.error_union,
.error_set,
@@ -2545,6 +2592,7 @@ pub const Type = struct {
.enum_literal,
.empty_struct,
.empty_struct_literal,
.type_info,
// These are function *bodies*, not pointers.
// Special exceptions have to be made when emitting functions due to
// this returning false.
@@ -5075,6 +5123,7 @@ pub const Type = struct {
.undefined => return Value.undef,
.generic_poison => unreachable,
.var_args_param => unreachable,
},
.struct_type => @panic("TODO"),
.simple_value => unreachable,