Skip to content

Commit

Permalink
stage2: analyzeSliceLen on comptime slices
Browse files Browse the repository at this point in the history
  • Loading branch information
g-w1 authored and andrewrk committed Oct 5, 2021
1 parent 2fe7b06 commit 5e153b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Sema.zig
Original file line number Diff line number Diff line change
Expand Up @@ -11608,7 +11608,7 @@ fn analyzeSliceLen(
if (slice_val.isUndef()) {
return sema.addConstUndef(Type.initTag(.usize));
}
return sema.fail(block, src, "TODO implement Sema analyzeSliceLen on comptime slice", .{});
return sema.addIntUnsigned(Type.usize, slice_val.sliceLen());
}
try sema.requireRuntimeBlock(block, src);
return block.addTyOp(.slice_len, Type.initTag(.usize), slice_inst);
Expand Down

0 comments on commit 5e153b5

Please sign in to comment.