-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve error message for call depth limit #85
Comments
Minimizing the code slightly: import std/sequtils
var seqReverse: proc(str: seq[char]): seq[char]
seqReverse = proc(str: seq[char]): seq[char] =
if str.len == 1:
str[0..0]
else:
var slice = str
slice.delete(0, 0)
concat(seqReverse(slice), str[0..0])
proc reverse*(str: string): string =
for c in seqReverse(toSeq(str)):
result.add c The problem is that the empty string test case causes an infinite recursion. So when the tests call check reverse("") == "" we get
A minimal reproducible example: proc reverse*(s: string): string =
reverse(s)
echo reverse("foo") |
I'm having a hard time debugging because no stack trace was printing as is the expected behaviour for @iHiD is there a way to get the I will try and test locally |
The
Opened a draft #87, but I'm away for a bit. |
Our test runner correctly handles a solution that hits the compile-time iteration limit. This commit just adds some test cases to assert that. Note that the runner currently behaves worse with a solution that hits the recursion limit at run-time (see #85).
Reported by @axtens in Slack:
The error:
The website produces the message:
The text was updated successfully, but these errors were encountered: