summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-09-14 20:25:52 +0200
committerAraq <rumpf_a@web.de>2015-09-14 20:25:52 +0200
commit0aa908c86c84c62bae52618b91d5f1cba4c0dea1 (patch)
tree81ad6c0b9fccf744c544896606486c7165f1d1eb /tests
parentf79ec6cdf5a33afc1de4b638149a1ed30d9b8656 (diff)
downloadNim-0aa908c86c84c62bae52618b91d5f1cba4c0dea1.tar.gz
clarify the meaning of the 'auto' metatype; 'auto' is now bind-multiple; fixes #3224
Diffstat (limited to 'tests')
-rw-r--r--tests/metatype/ttypedesc1.nim2
-rw-r--r--tests/types/tauto_excessive.nim20
2 files changed, 21 insertions, 1 deletions
diff --git a/tests/metatype/ttypedesc1.nim b/tests/metatype/ttypedesc1.nim
index 19072d966..d78c62a94 100644
--- a/tests/metatype/ttypedesc1.nim
+++ b/tests/metatype/ttypedesc1.nim
@@ -7,7 +7,7 @@ type
 
 proc getTypeName(t: typedesc): string = t.name
 
-proc foo(T: typedesc[float], a: expr): string =
+proc foo(T: typedesc[float], a: auto): string =
   result = "float " & $(a.len > 5)
 
 proc foo(T: typedesc[TFoo], a: int): string =
diff --git a/tests/types/tauto_excessive.nim b/tests/types/tauto_excessive.nim
new file mode 100644
index 000000000..2626b0cf4
--- /dev/null
+++ b/tests/types/tauto_excessive.nim
@@ -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")