mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-12 04:09:34 +00:00
16 lines
661 B
Nim
16 lines
661 B
Nim
discard """
|
|
output: '''42'''
|
|
"""
|
|
|
|
# Regression test: a `{.base.}` method whose body holds a closure iterator with a
|
|
# nested capturing closure must not crash the IC backend. The method's dispatcher
|
|
# (a `copySym` clone sharing the iterator) must NOT be lambda-lifted per module;
|
|
# otherwise the shared iterator's `up` field is baked twice under divergent owner
|
|
# identities -> "up references do not agree" / "could not determine closure type"
|
|
# (the real-world symptom: ~all libp2p async `{.base.}` methods failed under
|
|
# `nim ic`). Fixed by excluding `sfDispatcher` from nifbackend.ownsRuntimeRoutine.
|
|
|
|
import mmethupref
|
|
let b = Base(val: 40)
|
|
echo b.compute()
|