That's two days that I'm stuck in my code with the error 
    
    
    Error: type mismatch: got <type Float32Sort>
    but expected one of:
    template mkSort(s: typedesc[Float32Sort]): Z3_sort
      first type mismatch at position: 1
      required type for s: type Float32Sort
      but expression 'Float32Sort_3735007' is of type: type Float32Sort
    ...
    expression: mkSort(Float32Sort_3735007)
    
    
    Run

>From what I understand of the error message, the expected type is the same as 
>the provided one.

This is from a macro calling another macro with `varargs[untyped]` arguments 
calling a template with `typedesc` and generic arguments and then calling the 
final `mkSort(s: typedesc[Float32Sort])` template. I learned from [previous 
thread](https://forum.nim-lang.org/t/6273) that templates don't play well with 
`static` and `typedesc`.

Because the identifier `Float32Sort_3735007` has been generated by the compiler 
(gensymed), I thought there was a bug in templates _gensyming_ `typedesc` 
instead of injecting them as is. I've tried to extract that part of the code 
and reproduce it in a smaller case but this [sample 
compiles](https://play.nim-lang.org/#ix=2kVp). I've tried multiple versions of 
the compiler with the same error: presently using 1.2.0.

As Nim compiler error messages are very sensible to code paths and as I'm 
[learning macros](https://github.com/nim-lang/RFCs/issues/44), based on your 
experience, what should I try to refine the cause of the error message or work 
around it?

Reply via email to