authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-05-05 20:50:01-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-06-10 20:42:29-07:00
log73720b6975e2650ece48cc5f38495c091360c6c9
tree49626b3b12d29068dc9e3f4b06ba3141be5a372f
parentf7bd42785bf763e66557f886188ec53824cc45e0

Sema: update onePossibleValue for InternPool


1 files changed, 16 insertions(+), 4 deletions(-)

src/type.zig+16-4
......@@ -3909,15 +3909,27 @@ pub const Type = struct {
39093909 return null;
39103910 }
39113911 },
3912 .ptr_type => @panic("TODO"),
3913 .array_type => @panic("TODO"),
3912 .ptr_type => return null,
3913 .array_type => |array_type| {
3914 if (array_type.len == 0)
3915 return Value.initTag(.empty_array);
3916 if (array_type.child.toType().onePossibleValue(mod) != null)
3917 return Value.initTag(.the_only_possible_value);
3918 return null;
3919 },
39143920 .vector_type => |vector_type| {
39153921 if (vector_type.len == 0) return Value.initTag(.empty_array);
39163922 if (vector_type.child.toType().onePossibleValue(mod)) |v| return v;
39173923 return null;
39183924 },
3919 .opt_type => @panic("TODO"),
3920 .error_union_type => @panic("TODO"),
3925 .opt_type => |child| {
3926 if (child.toType().isNoReturn()) {
3927 return Value.null;
3928 } else {
3929 return null;
3930 }
3931 },
3932 .error_union_type => return null,
39213933 .simple_type => |t| switch (t) {
39223934 .f16,
39233935 .f32,