status-im/nim-stew

after change lib/system/arithmetics.nim proc inc to generic, the proc inc in this module cause ambiguous call

bung87 opened this issue · 5 comments

What's the purpose of your linked PR?

the purpose is really make targeting compile target system int bit width, check compiler/sigmatch.nim changes. before is match tyInt to tyInt32. also see the wrongly match caused issue nim-lang/Nim#20828

While the inc function in interval_set looks like it could use a round of improvement indeed (ie it has overly broad matching and dubious utility vs += cc @mjfh ), it's generally a good idea to avoid generic functions in core stdlib functions - if anything, you can overload instead which doesn't trigger nearly as many type resolution issues (and sometimes serve as "type anchors")

yeah, I agree, the orignal version already generic the poblem part is second argument y = 1 which now matches to tyInt

mjfh commented

the inc() will be replaced by incPt() which should do the job