getType doesn't reveal complete generic arguments
disruptek opened this issue · comments
Smooth Operator commented
Specification
getType
doesn't reveal complete generic arguments even for concrete types.
Example
import std/macros
type
A[B, C] = object
x: B
y: C
P[B, C] = proc(bar: A[B, C])
proc foo(bar: A[int, float]) =
discard
macro bug[B, C](a: P[B, C]) =
echo treeRepr(getType(a))
bug(P[int, float] foo)
bug(foo)
Actual Output
BracketExpr
Sym "proc"
Sym "void"
Sym "A"
BracketExpr
Sym "proc"
Sym "void"
Sym "A"
Expected Output
BracketExpr
Sym "proc"
Sym "void"
BracketExpr
Sym "A"
Sym "int"
Sym "float"
BracketExpr
Sym "proc"
Sym "void"
BracketExpr
Sym "A"
Sym "int"
Sym "float"
Possible Solution
A workaround is to use getTypeInst
but I don't see why getType
shouldn't work.
Additional Information
Nimskull Compiler Version 0.1.0-dev.21251 [linux: amd64]
Source hash: 5aca007cd7ef41a1128fbe6d6eb667ce612f847c
Source date: 2024-03-06
active boot switches: -d:release -d:danger⏎