status-im / nim-serialization

A modern and extensible serialization framework for Nim
62 stars 8 forks source link

Generics: getTypeInst can return an unusable symbol #32

Open mratsim opened 3 years ago

mratsim commented 3 years ago

getTypeInst can return a symbol that is not the type we expect but an nnkSym that we passed like T or E and cannot be manipulated.

See https://github.com/status-im/nimbus-eth2/issues/2219 writeup 9

  1. Unfixed, the recordFields macro in stew/shims doesn't save instantiated generics and in some cases return the abstract generic type instead of the instantiated one. There is an attempt to monkey patch around that in nim-serialization status-im/nim-serialization@82cdd5c. It mostly works, except when getTypeInst decides to return a dumb symbol instead of the type we actually want for unknown reason.

Another instance of https://github.com/nim-lang/RFCs/issues/44