Closed edubart closed 7 years ago
I've reproduced it and reported it to Nim upstream.
It seems like for generic procs, there is an identifier resolution happening before the macros kick-in and replace "_".
I may have a workaround by exporting a dummy "_" but I don't want to pollute namespace with that symbol. And it's used in tuple pattern-matching as well and maybe by other libs.
You can workaround that issue by using mixin _
from module macros in the procs that uses "_"
This workaround does not work with more complex silicing, like x[_, _, ^1..0|-1]
Not sure which identifier poses the issue here, with seq I can "solve" it by adding everything as mixin :/
proc foo4[T](): CustomSeq[T] =
result.data.newSeq(10)
# weird fancy corner case that feels special and wants special treatment
mixin _,`|-`
# why?
echo result[_, _, ^1..0|-1]
Case is closed upstream, but I really think generics have an issue as detailed by Krux
Minor test case:
When compiling the following error is shown:
Removing dynamic type
[T]
from the proc the code works fine.