-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
Description
Identity function fails to compile when using sugar function types.
Seem related to how "auto" type works with sugar function types.
Example
import sugar, macros
let identity: int -> int = x => x
By rewriting the => macro, seems that the "auto" type of function argument is not smart enough
This fails to compile
import sugar, macros
let identity: int -> int = proc(x: auto): int = x
This compiles successfully
import sugar, macros
let identity: int -> int = proc(x: int): auto = x
Current Output
Error: A nested proc can have generic parameters only when it is used as an operand to another routine and the types of the generic paramers can be inferred from the expected signature.
Expected Output
compilation successfull
Version
$ nim -v
Nim Compiler Version 1.5.1 [Linux: amd64]
Compiled at 2021-06-01
Copyright (c) 2006-2021 by Andreas Rumpf
git hash: c0e8199acc9f49caa36bae34d103600d112b66f3
active boot switches: -d:release