You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I was trying to make mapIt shorter in #19557, I discovered this bug.
Example
templatemapIt*(s: typed, op: untyped): untyped=typeOutType=typeof(
block:
var it{.inject.}: typeof(items(s));
op
)
block:
varresult: seq[OutType]
for it {.inject.} in s:
result&= op
resultstatic:
let m =@[func (x: int): int= x +100, func (x: int): int= x +200]
echo m.mapIt(func (x: int): int=it(x)).mapIt(it1)
Current Output
> nim r test2.nim
Hint: used config file '/home/user/.choosenim/toolchains/nim-1.6.4/config/nim.cfg' [Conf]
Hint: used config file '/home/user/.choosenim/toolchains/nim-1.6.4/config/config.nims' [Conf]
.........................................................fatal.nim(53) sysFatal
Error: unhandled exception: index 9 not in 0 .. 3 [IndexDefect]
Expected Output
The compiler should not crash.
Additional Information
TODO: bisect
at least present since 1.7.1
> nim -v
Nim Compiler Version 1.6.4 [Linux: amd64]
Compiled at 2022-02-09
Copyright (c) 2006-2021 by Andreas Rumpf
git hash: 7994556f3804c217035c44b453a3feec64405758
active boot switches: -d:release
The text was updated successfully, but these errors were encountered:
When I was trying to make
mapIt
shorter in #19557, I discovered this bug.Example
Current Output
Expected Output
The compiler should not crash.
Additional Information
TODO: bisect
at least present since 1.7.1
The text was updated successfully, but these errors were encountered: