mirror of
https://github.com/status-im/nim-stew.git
synced 2025-01-24 02:50:18 +00:00
447b23d3bf
* results: work around field access bugs See: * https://github.com/nim-lang/Nim/issues/3770 * https://github.com/nim-lang/Nim/issues/20900 * comment fixes * add test * document test better
14 lines
387 B
Nim
14 lines
387 B
Nim
import ../stew/results
|
|
|
|
{.used.}
|
|
|
|
# Oddly, this piece of code works when placed in `test_results.nim`
|
|
# See also https://github.com/status-im/nim-stew/pull/167
|
|
|
|
template repeater(b: Opt[int]): untyped =
|
|
# Check that Result can be used inside a template - this fails
|
|
# sometimes with field access errors as noted in above issue
|
|
b
|
|
let x = repeater(Opt.none(int))
|
|
doAssert x.isNone()
|