| ... | ... | @@ -3909,15 +3909,27 @@ pub const Type = struct { |
| 3909 | 3909 | return null; |
| 3910 | 3910 | } |
| 3911 | 3911 | }, |
| 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 | }, |
| 3914 | 3920 | .vector_type => |vector_type| { |
| 3915 | 3921 | if (vector_type.len == 0) return Value.initTag(.empty_array); |
| 3916 | 3922 | if (vector_type.child.toType().onePossibleValue(mod)) |v| return v; |
| 3917 | 3923 | return null; |
| 3918 | 3924 | }, |
| 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, |
| 3921 | 3933 | .simple_type => |t| switch (t) { |
| 3922 | 3934 | .f16, |
| 3923 | 3935 | .f32, |