mirror of https://github.com/status-im/nim-eth.git
avoid typed return in generic template (#739)
This commit is contained in:
parent
086ac68c86
commit
70b7519f02
|
@ -55,8 +55,10 @@ type
|
||||||
## See also:
|
## See also:
|
||||||
## * https://github.com/status-im/nimbus-eth1/issues/35
|
## * https://github.com/status-im/nimbus-eth1/issues/35
|
||||||
|
|
||||||
template to*[N: static int](v: array[N, byte], T: type FixedBytes[N]): T =
|
template to*[N: static int](v: array[N, byte], T: type FixedBytes[N]): untyped =
|
||||||
T(v)
|
# using a typed return here runs into an assortment of generics bugs when the
|
||||||
|
# compiler fails to instantiate N
|
||||||
|
FixedBytes[sizeof(v)](v)
|
||||||
|
|
||||||
template data*[N: static int](v: FixedBytes[N]): array[N, byte] =
|
template data*[N: static int](v: FixedBytes[N]): array[N, byte] =
|
||||||
distinctBase(v)
|
distinctBase(v)
|
||||||
|
|
Loading…
Reference in New Issue