allow `ElemType(XXX)` on inputs not called `T` (#414)

Currently, `ElemType` can only be called on `List` types when they are
first assigned to a variable called `T`. The template has been adjusted
so that different variable names may be used. The template can now also
be applied to in-line computed types, e.g., `ElemType(typeof(x))`.
This commit is contained in:
Etan Kissling 2021-10-21 09:43:42 +02:00 committed by GitHub
parent 004ea06b80
commit 33f548186d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -164,8 +164,8 @@ template ElemType*(T: type array): untyped =
template ElemType*(T: type seq): untyped = template ElemType*(T: type seq): untyped =
type(default(T)[0]) type(default(T)[0])
template ElemType*(T: type List): untyped = template ElemType*(T0: type List): untyped =
T.T T0.T
func isFixedSize*(T0: type): bool {.compileTime.} = func isFixedSize*(T0: type): bool {.compileTime.} =
mixin toSszType, enumAllSerializedFields mixin toSszType, enumAllSerializedFields