From b2ce61abebc959b79790ec2c3f44ba2cd04e1b5e Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Fri, 13 Nov 2026 15:19:15 +0000 Subject: [PATCH] 00any_to_opaque_narrow: a u64 keeps as many bytes as a pointer holds The test expected `0x123456789A` to keep all 8 bytes, which only a 64-bit pointer has room for: its x86 twin failed with "a u64 is all 8 bytes". On i686 the compiler keeps the low 4 bytes (0x3456789A) under every model, as it should, so the expectation now follows sizeof(). All 12 variants pass: JIT, x64 and x86, under gc/rc/none/own. Co-Authored-By: Claude Opus 5.5 --- tslang/test/tester/tests/00any_to_opaque_narrow.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tslang/test/tester/tests/00any_to_opaque_narrow.ts b/tslang/test/tester/tests/00any_to_opaque_narrow.ts index 4dcfd6000..02fd347fc 100644 --- a/tslang/test/tester/tests/00any_to_opaque_narrow.ts +++ b/tslang/test/tester/tests/00any_to_opaque_narrow.ts @@ -30,7 +30,9 @@ function main() { assert(opaqueOf(0x1234) == 0x1234, "an s32 keeps its value"); assert(opaqueOf(0xAB) == 0xAB, "a u8"); assert(opaqueOf(0xABCD) == 0xABCD, "a u16"); - assert(opaqueOf(0x123456789A) == 0x123456789A, "a u64 is all 8 bytes"); + // a pointer holds what it has room for: all 8 bytes of a u64, or on a 32-bit target its low 4 + const wide: u64 = sizeof() == 8 ? 0x123456789A : 0x3456789A; + assert(opaqueOf(0x123456789A) == wide, "a u64 is as many bytes as a pointer holds"); print("done."); }