Skip to content
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

Nim compiler is running into a recursion limit while trying to expand templates #1211

Open
shashankshampi opened this issue Oct 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@shashankshampi
Copy link

This issue can happen when there are too many nested templates or when the compiler can't efficiently manage deep template instantiations.

Current template: tests/asyncunit.nim
import unittest2, chronos

export unittest2, chronos

template asyncTeardown*(body: untyped): untyped =
teardown:
waitFor(
(
proc() {.async.} =
body
)()
)

template asyncSetup*(body: untyped): untyped =
setup:
waitFor(
(
proc() {.async.} =
body
)()
)

template asyncTest*(name: string, body: untyped): untyped =
test name:
waitFor(
(
proc() {.async.} =
body
)()
)

How to Reproduce:

Add the below test in file tests/pubsub/testgossipinternal.nim and then run any of them nim c -r tests/pubsub/testgossipinternal.nim "handle multiple SUBSCRIBE and UNSUBSCRIBE events"

Test file attached.
message.txt

Error Log:
This will crash with log below and when you do the same thing in the new file by adding the same test in the new file and running it works fine without any error.

error.log

@AlejandroCabeza
Copy link
Collaborator

Removed assignments so they are properly done during weekly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: new
Development

No branches or pull requests

3 participants