summary refs log tree commit diff stats
path: root/tests/reject
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2012-09-13 03:02:36 +0300
committerZahary Karadjov <zahary@gmail.com>2012-09-13 03:03:12 +0300
commitb2814df5cdfe5a7713d54c366fa798c92793ace8 (patch)
tree4c4f2fc39779319c9ded11e09784ca5e550f2148 /tests/reject
parent254bc714dd398e5e2bbbd3cc1c82e07a21bbcf4d (diff)
downloadNim-b2814df5cdfe5a7713d54c366fa798c92793ace8.tar.gz
fixed incorrect implicit conversion between arrays of different sizes; see #202
Diffstat (limited to 'tests/reject')
-rw-r--r--tests/reject/tarrayplus.nim13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/reject/tarrayplus.nim b/tests/reject/tarrayplus.nim
new file mode 100644
index 000000000..8c7452e85
--- /dev/null
+++ b/tests/reject/tarrayplus.nim
@@ -0,0 +1,13 @@
+discard """
+  msg: "type mismatch: got (array[0..2, float], array[0..1, float])"
+"""
+
+proc `+`*[R, T] (v1, v2: array[R, T]): array[R, T] =
+  for i in low(v1)..high(v1):
+    result[i] = v1[i] + v2[i]
+
+var 
+  v1: array[0..2, float] = [3.0, 1.2, 3.0]
+  v2: array[0..1, float] = [2.0, 1.0]
+  v3 = v1 + v2
+