Sema: relax undefined checks for concat

Closes #14037
This commit is contained in:
Jacob Young
2022-12-24 02:33:06 -05:00
parent 0559cdb554
commit 6cd8004213
2 changed files with 23 additions and 2 deletions

View File

@@ -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 };
{