From 33f548186d95e1a1ae74cefd265c865cf01cb13d Mon Sep 17 00:00:00 2001 From: Etan Kissling Date: Thu, 21 Oct 2021 09:43:42 +0200 Subject: [PATCH] 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))`. --- eth/ssz/types.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eth/ssz/types.nim b/eth/ssz/types.nim index 9e41bb3..12aeec4 100644 --- a/eth/ssz/types.nim +++ b/eth/ssz/types.nim @@ -164,8 +164,8 @@ template ElemType*(T: type array): untyped = template ElemType*(T: type seq): untyped = type(default(T)[0]) -template ElemType*(T: type List): untyped = - T.T +template ElemType*(T0: type List): untyped = + T0.T func isFixedSize*(T0: type): bool {.compileTime.} = mixin toSszType, enumAllSerializedFields