From ce767982e7c16a8263cb0ead1fc46beff7abc7df Mon Sep 17 00:00:00 2001 From: Gekctek Date: Wed, 18 Sep 2024 12:28:04 -0700 Subject: [PATCH] Fixing issue of empty iter in flatten stops prematurely --- src/Iter.mo | 2 +- tests/Itertools.Test.mo | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Iter.mo b/src/Iter.mo index 8140752..77f46d5 100644 --- a/src/Iter.mo +++ b/src/Iter.mo @@ -855,7 +855,7 @@ module { switch (nestedIter.next()) { case (?_iter) { iter := _iter; - iter.next(); + next(); }; case (_) null; }; diff --git a/tests/Itertools.Test.mo b/tests/Itertools.Test.mo index ccfd270..73c7719 100644 --- a/tests/Itertools.Test.mo +++ b/tests/Itertools.Test.mo @@ -699,6 +699,7 @@ let success = run([ let nestedIter = [ [1].vals(), [2, 3].vals(), + [].vals(), [4, 5, 6].vals(), ].vals();