diff --git a/lib/std/core/string.c3 b/lib/std/core/string.c3 index 58e20bc00..fd2e5f2d8 100644 --- a/lib/std/core/string.c3 +++ b/lib/std/core/string.c3 @@ -301,7 +301,7 @@ fn String String.strip_end(self, String suffix) @param [&inout] allocator : "The allocator to use for the String[]" @require delimiter.len > 0 : "The delimiter must be at least 1 character long" - @ensure return.len > 0 + @ensure return.len > 0 || skip_empty *> fn String[] String.split(self, Allocator allocator, String delimiter, usz max = 0, bool skip_empty = false) { @@ -360,7 +360,7 @@ faultdef BUFFER_EXCEEDED; @param [inout] buffer @param max : "Max number of elements, 0 means no limit, defaults to 0" @require delimiter.len > 0 : "The delimiter must be at least 1 character long" - @ensure return.len > 0 + @ensure return.len > 0 || skip_empty @return? BUFFER_EXCEEDED : `If there are more elements than would fit the buffer` *> fn String[]? String.split_to_buffer(s, String delimiter, String[] buffer, usz max = 0, bool skip_empty = false) diff --git a/releasenotes.md b/releasenotes.md index cae057f14..d99d5782e 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -59,6 +59,7 @@ - Compiler didn't check foreach over flexible array member, and folding a flexible array member was allowed #2164. - Too strict project view #2163. - Bug using `#foo` arguments with `$defined` #2173 +- Incorrect ensure on String.split. ### Stdlib changes - Added `String.quick_ztr` and `String.is_zstr`