Sema: fix in-memory coercion during comptime load

This commit is contained in:
Jacob Young
2023-06-01 21:03:53 -04:00
committed by Andrew Kelley
parent dc18739a73
commit e8bcdca044
2 changed files with 29 additions and 16 deletions

View File

@@ -1842,6 +1842,7 @@ pub const Value = struct {
pub fn elemValue(val: Value, mod: *Module, index: usize) Allocator.Error!Value {
return switch (val.ip_index) {
.none => switch (val.tag()) {
.bytes => try mod.intValue(Type.u8, val.castTag(.bytes).?.data[index]),
.repeated => val.castTag(.repeated).?.data,
.aggregate => val.castTag(.aggregate).?.data[index],
.slice => val.castTag(.slice).?.data.ptr.elemValue(mod, index),