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