status-im/nim-stew

Problem encountered with fauxClosure and distinct type

Opened this issue · 0 comments

See: https://gist.github.com/michaelsbradleyjr/d4aed98d91a6a4a132274bd66e5af826

L20 triggers a compiler error:

bar.nim(20, 16) Error: type mismatch: got <MyString>
but expected one of:
proc payload_16600094(nameCstr`gensym16591097_16600096: distinct[cstring])
first type mismatch at position: 1
  required type for nameCstr`gensym16591097: distinct cstring
  but expression 'nameCstr`gensym16591097' is of type: MyString

expression: payload_16600094(nameCstr`gensym16591097)

I'm not sure if it's something wrong in my code or an issue with the macro's implementation or something more fundamental with Nim.

Based on the compiler error, it seems the payload proc produced by the macro has distinct[cstring] but needs to have MyString.