diff --git a/serialization/object_serialization.nim b/serialization/object_serialization.nim index f06ddba..8007482 100644 --- a/serialization/object_serialization.nim +++ b/serialization/object_serialization.nim @@ -186,21 +186,21 @@ template GetFieldType(FT: type FieldTag): type = template readFieldIMPL[Reader](field: type FieldTag, reader: var Reader): auto = mixin readValue - type FieldType = GetFieldType(field) + # Nim 1.6.12: `type FieldType = GetFieldType(field)` here breaks `NimYAML`. {.gcsafe.}: # needed by Nim-1.6 - # TODO: The `FieldType` coercion below is required to deal + # TODO: The `GetFieldType(field)` coercion below is required to deal # with a nim bug caused by the distinct `ssz.List` type. # It seems to break the generics cache mechanism, which # leads to an incorrect return type being reported from # the `readFieldIMPL` function. - # additional notes: putting the FieldType coercion in + # additional notes: putting the GetFieldType(field) coercion in # `makeFieldReadersTable` will cause problems when orc enabled # hence, move it here - when distinctBase(FieldType) isnot FieldType: - FieldType reader.readValue(FieldType) + when distinctBase(GetFieldType(field)) isnot GetFieldType(field): + GetFieldType(field) reader.readValue(GetFieldType(field)) else: - reader.readValue(FieldType) + reader.readValue(GetFieldType(field)) template writeFieldIMPL*[Writer](writer: var Writer, fieldTag: type FieldTag,