From 98ec1fbee6fe77b06adf09eda6c2540c49468893 Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Fri, 16 Jan 2026 22:40:38 +0000 Subject: [PATCH] fix another size-recalculation mistake in 'PersistentVector.splitRight' function. (When we are splitting in the middle of a BRANCH, we want to subtract the old child size from the remainder, and then add the new child size to the remainder, because this calculation will account for the splitting of preceding elements.) --- fcore/persistent-vector.sml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fcore/persistent-vector.sml b/fcore/persistent-vector.sml index a7f7989..2808b0d 100644 --- a/fcore/persistent-vector.sml +++ b/fcore/persistent-vector.sml @@ -450,13 +450,16 @@ struct else let val newChildSize = getFinishIdx child - val difference = oldChildSize - newChildSize val sizes = Vector.tabulate (VectorSlice.length sizesSlice + 1, fn i => if i = 0 then newChildSize else - VectorSlice.sub (sizesSlice, i - 1) - difference + let + val el = VectorSlice.sub (sizesSlice, i - 1) + in + el - oldChildSize + newChildSize + end ) val child = VectorSlice.full #[child]