From 152a2ceaf738301cd59165a4f17d915391321bdc Mon Sep 17 00:00:00 2001 From: mlugg Date: Tue, 26 Mar 2024 03:56:54 +0000 Subject: compiler: audit uses of `ptr.addr` in the frontend This commit also performs some refactors to `TypedValue.print` in preparation for improved comptime pointer access logic. Once that logic exists, `TypedValue.print` can use Sema to access pointers for more helpful printing. This commit also implements proposal #19435, because the existing logic there relied on some blatantly incorrect code in `Value.sliceLen`. Resolves: #19435 --- test/behavior/basic.zig | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'test/behavior/basic.zig') diff --git a/test/behavior/basic.zig b/test/behavior/basic.zig index e76416ddb0..c9abaf9c8b 100644 --- a/test/behavior/basic.zig +++ b/test/behavior/basic.zig @@ -693,31 +693,6 @@ test "string concatenation" { try expect(b[len] == 0); } -fn manyptrConcat(comptime s: [*:0]const u8) [*:0]const u8 { - return "very " ++ s; -} - -test "comptime manyptr concatenation" { - if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - - const s = "epic"; - const actual = manyptrConcat(s); - const expected = "very epic"; - - const len = mem.len(actual); - const len_with_null = len + 1; - { - var i: u32 = 0; - while (i < len_with_null) : (i += 1) { - try expect(actual[i] == expected[i]); - } - } - try expect(actual[len] == 0); - try expect(expected[len] == 0); -} - test "result location is optional inside error union" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO -- cgit v1.2.3