mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
InternPool: implement typeHasOnePossibleValue for simple_type
This commit is contained in:
parent
50f33734c6
commit
b125063dcf
47
src/Sema.zig
47
src/Sema.zig
@ -32776,7 +32776,52 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value {
|
||||
.vector_type => @panic("TODO"),
|
||||
.optional_type => @panic("TODO"),
|
||||
.error_union_type => @panic("TODO"),
|
||||
.simple_type => @panic("TODO"),
|
||||
.simple_type => |t| 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,
|
||||
.anyopaque,
|
||||
.bool,
|
||||
.type,
|
||||
.anyerror,
|
||||
.comptime_int,
|
||||
.comptime_float,
|
||||
.@"anyframe",
|
||||
.enum_literal,
|
||||
.atomic_order,
|
||||
.atomic_rmw_op,
|
||||
.calling_convention,
|
||||
.address_space,
|
||||
.float_mode,
|
||||
.reduce_op,
|
||||
.call_modifier,
|
||||
.prefetch_options,
|
||||
.export_options,
|
||||
.extern_options,
|
||||
.type_info,
|
||||
=> return null,
|
||||
|
||||
.void => return Value.void,
|
||||
.noreturn => return Value.initTag(.unreachable_value),
|
||||
.null => return Value.null,
|
||||
.undefined => return Value.undef,
|
||||
|
||||
.generic_poison => return error.GenericPoison,
|
||||
},
|
||||
.struct_type => @panic("TODO"),
|
||||
.simple_value => unreachable,
|
||||
.extern_func => unreachable,
|
||||
|
||||
47
src/type.zig
47
src/type.zig
@ -5030,7 +5030,52 @@ pub const Type = struct {
|
||||
.vector_type => @panic("TODO"),
|
||||
.optional_type => @panic("TODO"),
|
||||
.error_union_type => @panic("TODO"),
|
||||
.simple_type => @panic("TODO"),
|
||||
.simple_type => |t| 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,
|
||||
.anyopaque,
|
||||
.bool,
|
||||
.type,
|
||||
.anyerror,
|
||||
.comptime_int,
|
||||
.comptime_float,
|
||||
.@"anyframe",
|
||||
.enum_literal,
|
||||
.atomic_order,
|
||||
.atomic_rmw_op,
|
||||
.calling_convention,
|
||||
.address_space,
|
||||
.float_mode,
|
||||
.reduce_op,
|
||||
.call_modifier,
|
||||
.prefetch_options,
|
||||
.export_options,
|
||||
.extern_options,
|
||||
.type_info,
|
||||
=> return null,
|
||||
|
||||
.void => return Value.void,
|
||||
.noreturn => return Value.initTag(.unreachable_value),
|
||||
.null => return Value.null,
|
||||
.undefined => return Value.undef,
|
||||
|
||||
.generic_poison => unreachable,
|
||||
},
|
||||
.struct_type => @panic("TODO"),
|
||||
.simple_value => unreachable,
|
||||
.extern_func => unreachable,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user