summary refs log tree commit diff stats
path: root/tests/template/t17433.nim
blob: 053d33ff0acce8885db5059739348069bc970a57 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Inside template bodies, ensure return types referencing a param are replaced.
# This helps guarantee that return parameter analysis happens after argument
# analysis.
 
# bug #17433

from std/macros import expandMacros

proc bar(a: typedesc): a = default(a)
doAssert bar(float) == 0.0
doAssert bar(string) == ""

template main =
  proc baz(a: typedesc): a = default(a)
  doAssert baz(float) == 0.0
main()