Below newStorage[T] and newStorageOfCap[T] call getUnderlyingType(T), which shouldn't work because T is a type and getUnderlyingType takes an openArray argument. However it works due to a Nim bug where T is treated as a value of its type.
To make this work with and without the bug fixed, add an additional getUnderlyingType overload that takes a type openArray parameter instead.
Below
newStorage[T]
andnewStorageOfCap[T]
callgetUnderlyingType(T)
, which shouldn't work becauseT
is a type andgetUnderlyingType
takes anopenArray
argument. However it works due to a Nim bug whereT
is treated as a value of its type.To make this work with and without the bug fixed, add an additional
getUnderlyingType
overload that takes atype openArray
parameter instead.