From 8b08b4ec1c9f818533560ff56c104538cc2dfed5 Mon Sep 17 00:00:00 2001 From: treeform Date: Mon, 25 May 2026 16:48:32 -0700 Subject: [PATCH] Add issue 54 Nim regression --- .github/workflows/nim.yml | 4 ++-- tests/test_nim.nim | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nim.yml b/.github/workflows/nim.yml index 98804c0..f22ce87 100644 --- a/.github/workflows/nim.yml +++ b/.github/workflows/nim.yml @@ -23,10 +23,10 @@ jobs: - name: Install dependencies run: nimble install -y bumpy chroma vmath - name: Build test DLL - run: nim c --mm:arc --app:lib -d:gennyNim -o:tests/generated/libtest.so tests/test.nim + run: nim c -d:release --mm:arc --app:lib -d:gennyNim -o:tests/generated/libtest.so tests/test.nim - name: Run Nim-C-Nim sandwich test run: | - nim c --mm:arc -o:tests/generated/test_nim tests/test_nim.nim + nim c -d:release --mm:arc -o:tests/generated/test_nim tests/test_nim.nim cd tests/generated && LD_LIBRARY_PATH=. ./test_nim - name: Build Pixie bindings run: cd ../pixie && nim c --mm:arc --app:lib -d:gennyNim --path:../genny/src --path:src -o:bindings/generated/libpixie.so bindings/bindings.nim diff --git a/tests/test_nim.nim b/tests/test_nim.nim index 9ee31c9..28d8d42 100644 --- a/tests/test_nim.nim +++ b/tests/test_nim.nim @@ -30,6 +30,18 @@ block: doAssert refObj.simpleRefB == 50, "simpleRefB should be 50" refObj.doit() +echo "Testing issue #54 ref object method lifetime" +proc issue54CrashAfterAccess() = + var s2 = newSimpleRefObj() + s2.simpleRefA = 3 + doAssert s2.simpleRefA == 3, "simpleRefA should first be 3" + s2.simpleRefA = 8 + doAssert s2.simpleRefA == 8, "simpleRefA should update to 8" + s2.doit() + +issue54CrashAfterAccess() +doAssert simpleCall(42) == 42, "execution should continue after issue #54 regression" + echo "Testing SeqInt" block: let seqInt = newSeqInt()