clarify the meaning of the 'auto' metatype; 'auto' is now bind-multiple; fixes #3224
This commit is contained in:
parent
f79ec6cdf5
commit
0aa908c86c
7 changed files with 91 additions and 55 deletions
20
tests/types/tauto_excessive.nim
Normal file
20
tests/types/tauto_excessive.nim
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
discard """
|
||||
output: '''10
|
||||
10.0
|
||||
1.0hiho'''
|
||||
"""
|
||||
|
||||
# bug #3224
|
||||
proc f(x: auto): auto =
|
||||
result = $(x+10)
|
||||
|
||||
proc f(x, y: auto): auto =
|
||||
result = $(x+y)
|
||||
|
||||
|
||||
echo f(0) # prints 10
|
||||
echo f(0.0) # prints 10.0
|
||||
|
||||
proc `+`(a, b: string): string = a & b
|
||||
|
||||
echo f(0.7, 0.3), f("hi", "ho")
|
||||
Loading…
Add table
Add a link
Reference in a new issue