InternPool: implement hasRuntimeBitsAdvanced for simple_type
This commit is contained in:
@@ -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,
|
||||
|
||||
53
src/type.zig
53
src/type.zig
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user