xxx.nim(6, 5) Error: type mismatch: got <untyped>
but expected one of:
proc echo(x: varargs[typed, `$`])
first type mismatch at position: 1
required type for x: varargs[typed]
but expression 'f(1)(2)' is of type: untyped
Expected result
f after currying should have the type int -> (int -> auto).
Printing f.typeof() gives proc (a: int): proc (b: int): untyped{.closure.}{.noSideEffect, gcsafe, locks: 0.}.
Software used
Nim 1.6.4
nim_curry 0.1.0 installed using Nimble
Additional context
I first found out about this after trying to curry a lambda expression like so:
import pkg/[nim_curry]
let f = proc (a, b: int): auto {.curry.} = 0
echo(f(1)(2))
If this bug is fixed, it may enable writing lambda expressions the shorter way: (a: int, b: int) {.curry.} => 0.
Description
Currying a
proc
definition returningauto
makes the compilation fail.Example code
Current result
Compilation fails with:
Expected result
f
after currying should have the typeint -> (int -> auto)
. Printingf.typeof()
givesproc (a: int): proc (b: int): untyped{.closure.}{.noSideEffect, gcsafe, locks: 0.}
.Software used
1.6.4
0.1.0
installed using NimbleAdditional context
I first found out about this after trying to curry a lambda expression like so:
If this bug is fixed, it may enable writing lambda expressions the shorter way:
(a: int, b: int) {.curry.} => 0
.