| author | |
| committer | |
| log | b2391a7d4425418a29598523dcbdf2bfc9325ecd |
| tree | 4c0fb2197e1d5f02fe3cab697aa08d703cc1a4c0 |
| parent | 71c4077c359096d0706a251a10eeae6c41f299ca |
Being able to create a pointer to the non-opv sentinel means that these
types have to actually be stored.2 files changed, 7 insertions(+), 4 deletions(-)
src/Sema.zig+4-2| ... | ... | @@ -33468,11 +33468,13 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value { |
| 33468 | 33468 | .inferred_error_set_type, |
| 33469 | 33469 | => null, |
| 33470 | 33470 | |
| 33471 | inline .array_type, .vector_type => |seq_type| { | |
| 33472 | if (seq_type.len == 0) return (try mod.intern(.{ .aggregate = .{ | |
| 33471 | inline .array_type, .vector_type => |seq_type, seq_tag| { | |
| 33472 | const has_sentinel = seq_tag == .array_type and seq_type.sentinel != .none; | |
| 33473 | if (seq_type.len + @boolToInt(has_sentinel) == 0) return (try mod.intern(.{ .aggregate = .{ | |
| 33473 | 33474 | .ty = ty.toIntern(), |
| 33474 | 33475 | .storage = .{ .elems = &.{} }, |
| 33475 | 33476 | } })).toValue(); |
| 33477 | ||
| 33476 | 33478 | if (try sema.typeHasOnePossibleValue(seq_type.child.toType())) |opv| { |
| 33477 | 33479 | return (try mod.intern(.{ .aggregate = .{ |
| 33478 | 33480 | .ty = ty.toIntern(), |
src/type.zig+3-2| ... | ... | @@ -2479,8 +2479,9 @@ pub const Type = struct { |
| 2479 | 2479 | .inferred_error_set_type, |
| 2480 | 2480 | => return null, |
| 2481 | 2481 | |
| 2482 | inline .array_type, .vector_type => |seq_type| { | |
| 2483 | if (seq_type.len == 0) return (try mod.intern(.{ .aggregate = .{ | |
| 2482 | inline .array_type, .vector_type => |seq_type, seq_tag| { | |
| 2483 | const has_sentinel = seq_tag == .array_type and seq_type.sentinel != .none; | |
| 2484 | if (seq_type.len + @boolToInt(has_sentinel) == 0) return (try mod.intern(.{ .aggregate = .{ | |
| 2484 | 2485 | .ty = ty.toIntern(), |
| 2485 | 2486 | .storage = .{ .elems = &.{} }, |
| 2486 | 2487 | } })).toValue(); |