summary refs log tree commit diff stats
path: root/tests/overload
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-10-28 12:07:54 +0200
committerAndreas Rumpf <rumpf_a@web.de>2017-10-28 12:07:54 +0200
commit788cf426123e00a7879dbd9fc765cefb08bd3ddc (patch)
treebbcbb0a1f431a533fc4f6934db48683af77e05c7 /tests/overload
parente2af486434c7ff401c412d890b490b4ac11ab321 (diff)
downloadNim-788cf426123e00a7879dbd9fc765cefb08bd3ddc.tar.gz
added another test case for #6526
Diffstat (limited to 'tests/overload')
-rw-r--r--tests/overload/tprefer_tygenericinst.nim11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/overload/tprefer_tygenericinst.nim b/tests/overload/tprefer_tygenericinst.nim
index 72f5a94fd..ab461a0f4 100644
--- a/tests/overload/tprefer_tygenericinst.nim
+++ b/tests/overload/tprefer_tygenericinst.nim
@@ -4,6 +4,8 @@ This has the highest precedence.
 This has the second-highest precedence.
 This has the lowest precedence.
 baseobj ==
+true
+even better! ==
 true'''
 """
 
@@ -47,6 +49,7 @@ testPred(1)
 type
   BaseObj = ref object of RootObj
   DerivedObj = ref object of BaseObj
+  OtherDerivate = ref object of BaseObj
 
 proc `==`*[T1, T2: BaseObj](a: T1, b: T2): bool =
   echo "baseobj =="
@@ -55,3 +58,11 @@ proc `==`*[T1, T2: BaseObj](a: T1, b: T2): bool =
 let a = DerivedObj()
 let b = DerivedObj()
 echo a == b
+
+proc `==`*[T1, T2: OtherDerivate](a: T1, b: T2): bool =
+  echo "even better! =="
+  return true
+
+let a2 = OtherDerivate()
+let b2 = OtherDerivate()
+echo a2 == b2