Commit cdf6acba96

Andrew Kelley <andrew@ziglang.org>
2023-05-03 21:46:56
InternPool: implement hasWellDefinedLayout for simple_type
1 parent d1887ab
Changed files (1)
src/type.zig
@@ -2721,7 +2721,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| 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,
+                .void,
+                => true,
+
+                .anyerror,
+                .@"anyframe",
+                .anyopaque,
+                .atomic_order,
+                .atomic_rmw_op,
+                .calling_convention,
+                .address_space,
+                .float_mode,
+                .reduce_op,
+                .call_modifier,
+                .prefetch_options,
+                .export_options,
+                .extern_options,
+                .type,
+                .comptime_int,
+                .comptime_float,
+                .noreturn,
+                .null,
+                .undefined,
+                .enum_literal,
+                .type_info,
+                .generic_poison,
+                => false,
+            },
             .struct_type => @panic("TODO"),
             .simple_value => unreachable,
             .extern_func => unreachable,