diff --git a/src/isSlice.zig b/src/isSlice.zig index 9922a78bd80b474aa69899ab118bf32f47d2ccac..be8cb41f61e57ad4f26ae5e31d715864bed85951 100644 --- a/src/isSlice.zig +++ b/src/isSlice.zig @@ -4,7 +4,8 @@ const extras = @import("./lib.zig"); pub fn isSlice(comptime T: type) bool { if (comptime is(.Pointer)(T)) { - return @typeInfo(T).Pointer.size == .Slice; + if (@typeInfo(T).Pointer.size == .Slice) return true; + if (@typeInfo(T).Pointer.size == .One and is(.Array)(std.meta.Child(T))) return true; } return false; } @@ -25,3 +26,7 @@ test { try std.testing.expect(!isSlice(@TypeOf(array))); try std.testing.expect(!isSlice(@TypeOf(&array[0]))); } + +test { + try std.testing.expect(isSlice(@TypeOf(&[_]u32{ 66, 81, 99, 24, 36, 65, 24, 19, 25, 44 }))); +}