| ... | ... | @@ -32950,14 +32950,27 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value { |
| 32950 | 32950 | } |
| 32951 | 32951 | }, |
| 32952 | 32952 | .ptr_type => return null, |
| 32953 | | .array_type => @panic("TODO"), |
| 32953 | .array_type => |array_type| { |
| 32954 | if (array_type.len == 0) |
| 32955 | return Value.initTag(.empty_array); |
| 32956 | if ((try sema.typeHasOnePossibleValue(array_type.child.toType())) != null) { |
| 32957 | return Value.initTag(.the_only_possible_value); |
| 32958 | } |
| 32959 | return null; |
| 32960 | }, |
| 32954 | 32961 | .vector_type => |vector_type| { |
| 32955 | 32962 | if (vector_type.len == 0) return Value.initTag(.empty_array); |
| 32956 | 32963 | if (try sema.typeHasOnePossibleValue(vector_type.child.toType())) |v| return v; |
| 32957 | 32964 | return null; |
| 32958 | 32965 | }, |
| 32959 | | .opt_type => @panic("TODO"), |
| 32960 | | .error_union_type => @panic("TODO"), |
| 32966 | .opt_type => |child| { |
| 32967 | if (child.toType().isNoReturn()) { |
| 32968 | return Value.null; |
| 32969 | } else { |
| 32970 | return null; |
| 32971 | } |
| 32972 | }, |
| 32973 | .error_union_type => return null, |
| 32961 | 32974 | .simple_type => |t| switch (t) { |
| 32962 | 32975 | .f16, |
| 32963 | 32976 | .f32, |