I'm trying to use sequtils together with the nim-result library, and I'm getting an error like below. When I split mapIt and filterIt to separate lines, it compiles fine. The same error shows up both for nim-result and pkg/stew/result. Is this a bug in the stdlib? or in the result library? or is it just some unlucky cross of features that's not going to be changed?
The same code & error on the playground: https://play.nim-lang.org/#ix=2T6e
C:\prog\tmp>type bug_resultcatch.nim
import results
import sequtils
proc foobar(s: string): int =
raise newException(CatchableError, "mock error: " & s)
let t2 = @["foo"].mapIt(it.foobar.catch).filterIt(it.isOk)
# This works:
#let t1 = @["foo"].mapIt(it.foobar.catch)
#let t2 = t1.filterIt(it.isOk)
echo len(t2)
C:\prog\tmp>nim c -r bug_resultcatch.nim
Hint: used config file 'C:\Users\Mateusz\.choosenim\toolchains\nim-1.4.2\config\nim.cfg' [Conf]
Hint: used config file 'C:\Users\Mateusz\.choosenim\toolchains\nim-1.4.2\config\config.nims' [Conf]
Hint: used config file 'C:\prog\tmp\config.nims' [Conf]
.......
C:\prog\tmp\bug_resultcatch.nim(8, 41) template/generic instantiation of `filterIt` from here
C:\Users\Mateusz\.nimble\pkgs\result-0.2.0\results.nim(408, 6) Error: the field 'v' is not accessible.