Open
Description
Example
import options, macros
macro typedTree(n: typed): untyped =
result = n
echo treeRepr n
proc foo(x = none(Natural)) {.typedTree.} = discard
Current Output
ProcDef
Sym "foo"
Empty
Empty
FormalParams
Empty
IdentDefs
Sym "x"
Empty
Call
OpenSymChoice 2 "none"
Sym "Natural"
Empty
Empty
DiscardStmt
Empty
Expected Output
ProcDef
Sym "foo"
Empty
Empty
FormalParams
Empty
IdentDefs
Sym "x"
Empty
Call
Sym "none"
Sym "Natural"
Empty
Empty
DiscardStmt
Empty
Additional Information
- CPS relies on the value to have a type to infer the parameter type. However that is not the case here where somehow
none
was anOpenSymChoice
, which should be impossible in typed AST.
$ nim -v
Nim Compiler Version 1.7.1 [Linux: amd64]
Compiled at 2021-11-08
Copyright (c) 2006-2021 by Andreas Rumpf
git hash: 83a9c3ba31d180cd5e31026d8b7603bf7adea18c
active boot switches: -d:release -d:nimUseLinenoise