From 6cd80042133c28d37bb30eba49d022a4fb23c058 Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Sat, 24 Dec 2022 02:33:06 -0500 Subject: Sema: relax undefined checks for concat Closes #14037 --- test/behavior/array.zig | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/behavior/array.zig') diff --git a/test/behavior/array.zig b/test/behavior/array.zig index 155ac294cf..0faa58a7d4 100644 --- a/test/behavior/array.zig +++ b/test/behavior/array.zig @@ -45,6 +45,19 @@ fn getArrayLen(a: []const u32) usize { return a.len; } +test "array concat with undefined" { + { + var array = "hello".* ++ @as([5]u8, undefined); + array[5..10].* = "world".*; + try std.testing.expect(std.mem.eql(u8, &array, "helloworld")); + } + { + var array = @as([5]u8, undefined) ++ "world".*; + array[0..5].* = "hello".*; + try std.testing.expect(std.mem.eql(u8, &array, "helloworld")); + } +} + test "array concat with tuple" { const array: [2]u8 = .{ 1, 2 }; { -- cgit v1.2.3