Reported by KosKosynsky on the #science channel (added steps for a minimal repro):
import datamancer, strutils
var flota = toDf({"x" : @["a", "b"], "y" : @["1", "2"], "z" : @[1, 3]})
let flota_cols = flota.getKeys()
for i_col in flota_cols:
if (flota[i_col].nativeColKind == colString):
flota = flota.mutate(f{string -> string: i_col ~ strip(idx(i_col))})
echo flota
which fails in the determineTypeFromProc helper, which tries to look at the default arguments for type info from the latest argument to strip (we shouldn't even have to look at that, but in any case shouldn't fail!).
The issue is that we assume that the last field of a default nnkIdentDefs is a symbol, but it's not in this case. The offending node is:
IdentDefs
Sym "leading"
Empty
Ident "true"
from the params sequence:
IdentDefs
Sym "s"
Sym "string"
Empty
IdentDefs
Sym "leading"
Empty
Ident "true"
IdentDefs
Sym "trailing"
Empty
Ident "true"
IdentDefs
Sym "chars"
BracketExpr
Sym "set"
Sym "char"
Ident "Whitespace"
Instead of
typ = pArg[pArg.len - 1].getType # use the default values type
we should check if the node is a type first before calling getType.
Question: what to do for idents?
Just find a way to fix it... :)
Reported by KosKosynsky on the #science channel (added steps for a minimal repro):
which fails in the
determineTypeFromProchelper, which tries to look at the default arguments for type info from thelatestargument to strip (we shouldn't even have to look at that, but in any case shouldn't fail!).The issue is that we assume that the last field of a default
nnkIdentDefsis a symbol, but it's not in this case. The offending node is:from the
paramssequence:Instead of
we should check if the node is a type first before calling
getType.Question: what to do for idents?
Just find a way to fix it... :)