recur
fails when the DateFunction
provided returns false outside of the range
#17513
Labels
dates
Dates, times, and the Dates stdlib module
The way
recur
is currently written requires that it be able to find at least one case where theDateFunction
returnstrue
once it steps outside of theStepRange
provided. For this reason, even though these two examples should produce identical results, the second one throws an error:This happens because
adjust
is called again even whencmp(next, stop)
returns0
. If that call fails (because theDateFunction
doesn't return true withinlimit
attempts) then an error results, even though we're already done filling our array of results.Of course, here the bug could be avoided by simply removing the second check from the
DateFunction
. The case in which I encountered this problem is a little more complex, but I think the point is adequately demonstrated by this example.I'm running a random recent build (
0.5.0-dev+5275
; sorry!) but I've verified that this is present on0.4.5
as well. Here's my current version information:The text was updated successfully, but these errors were encountered: