t21247.nim 494 B

12345678910111213141516
  1. import std/typetraits
  2. type
  3. QueryParams* = distinct seq[(string, string)]
  4. converter toBase*(params: var QueryParams): var seq[(string, string)] =
  5. params.distinctBase
  6. proc foo(): QueryParams =
  7. # Issue was that the implicit converter call didn't say that it took the
  8. # address of the parameter it was converting. This led to the parameter not being
  9. # passed as a fat pointer which toBase expected
  10. result.add(("hello", "world"))
  11. assert foo().distinctBase() == @[("hello", "world")]