From 12eeb42f6b4e70e66ea5c8d1ae22424802b582ad Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 19 Jan 2026 19:16:09 -0800 Subject: [PATCH] test explicitly typed ANY assignment --- test/testdata.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/testdata.cpp b/test/testdata.cpp index 51b295f..1c11a40 100644 --- a/test/testdata.cpp +++ b/test/testdata.cpp @@ -124,8 +124,20 @@ void testAssignAny() val = 42; + // automagic ANY assignment promotes to StoreType + testEq(val["->"].type(), TypeCode::Int64); + testEq(val.as(), 42); + + { + auto us = TypeDef(TypeCode::UInt32).create(); + us = -1; + val.from(us); // typed ANY assignment + } + testEq(val["->"].type(), TypeCode::UInt32); + testEq(val.as(), 0xffffffff); + testThrows([&val](){ - val.from(val); + val.from(val); // self assignment would create infinite recursion }); } @@ -550,7 +562,7 @@ void test_cache_sync() MAIN(testdata) { - testPlan(189); + testPlan(193); testSetup(); testTraverse(); testAssign();