I need advice from the Nim compiler ninja.
I am inside semResolvedCall(semcall.nim) function and I have instance of TCandidate object which has bindings field. It is a table from generic param types to concrete param types. How do I extract a concreate return type? I don't need anything else. I just can't figure out how to construct a valid key for TIdTable table.
So far I am doing it in a silly way:
for pair in x.bindings.pairs:
result.typ = PType(pair.value)
break
If anyone interested I am trying to make the following example to compile:
type Currency* {.pure.} = enum
GBP, USD, EUR, JPY
type CurrencyAmount*[Ccy: static[Currency]] = distinct float
proc `+`[T: CurrencyAmount](a,b: T): T {.borrow.}
type USD = CurrencyAmount[Currency.USD]
let a = 30.USD + 50.USD
Araq, replied in the IRC channel. It is
PType(idTableGet(x.bindings, x.callee.sons[0]))