diff options
author | Araq <rumpf_a@web.de> | 2017-10-27 20:55:36 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2017-10-27 20:55:36 +0200 |
commit | 9c00f6decd4453a4233450a60ccef05b20e9f24a (patch) | |
tree | 99d5169289a60ac2e038b95737c2995929a3e16c /tests/overload | |
parent | 8c94a00e02a0fe610573302096294a9b6aa50e43 (diff) | |
download | Nim-9c00f6decd4453a4233450a60ccef05b20e9f24a.tar.gz |
fixes #6526
Diffstat (limited to 'tests/overload')
-rw-r--r-- | tests/overload/tprefer_tygenericinst.nim | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/tests/overload/tprefer_tygenericinst.nim b/tests/overload/tprefer_tygenericinst.nim index 56541c7e8..72f5a94fd 100644 --- a/tests/overload/tprefer_tygenericinst.nim +++ b/tests/overload/tprefer_tygenericinst.nim @@ -2,7 +2,9 @@ discard """ output: '''Version 2 was called. This has the highest precedence. This has the second-highest precedence. -This has the lowest precedence.''' +This has the lowest precedence. +baseobj == +true''' """ # bug #2220 @@ -26,13 +28,13 @@ template testPred(a: untyped) = type SomeA = A|A # A hack to make "A" a typeclass. when a >= 3: - proc p[X](x: X) = - echo "This has the highest precedence." - when a >= 2: proc p[X: A](x: X) = + echo "This has the highest precedence." + when a == 2: + proc p[X: SomeA](x: X) = echo "This has the second-highest precedence." when a >= 1: - proc p[X: SomeA](x: X) = + proc p[X](x: X) = echo "This has the lowest precedence." p(B()) @@ -40,3 +42,16 @@ template testPred(a: untyped) = testPred(3) testPred(2) testPred(1) + +# bug #6526 +type + BaseObj = ref object of RootObj + DerivedObj = ref object of BaseObj + +proc `==`*[T1, T2: BaseObj](a: T1, b: T2): bool = + echo "baseobj ==" + return true + +let a = DerivedObj() +let b = DerivedObj() +echo a == b |