void type for generics
This commit is contained in:
parent
05cffb9370
commit
00da785f5d
5 changed files with 27 additions and 13 deletions
13
tests/accept/compile/tvoid.nim
Normal file
13
tests/accept/compile/tvoid.nim
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
discard """
|
||||
output: "he, no return type; a string"
|
||||
"""
|
||||
|
||||
proc ReturnT[T](): T =
|
||||
when T is void:
|
||||
echo "he, no return type;"
|
||||
else:
|
||||
result = " a string"
|
||||
|
||||
ReturnT[void]()
|
||||
echo ReturnT[string]()
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue