added another test case for #6526
This commit is contained in:
parent
e2af486434
commit
788cf42612
1 changed files with 11 additions and 0 deletions
|
|
@ -4,6 +4,8 @@ This has the highest precedence.
|
||||||
This has the second-highest precedence.
|
This has the second-highest precedence.
|
||||||
This has the lowest precedence.
|
This has the lowest precedence.
|
||||||
baseobj ==
|
baseobj ==
|
||||||
|
true
|
||||||
|
even better! ==
|
||||||
true'''
|
true'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -47,6 +49,7 @@ testPred(1)
|
||||||
type
|
type
|
||||||
BaseObj = ref object of RootObj
|
BaseObj = ref object of RootObj
|
||||||
DerivedObj = ref object of BaseObj
|
DerivedObj = ref object of BaseObj
|
||||||
|
OtherDerivate = ref object of BaseObj
|
||||||
|
|
||||||
proc `==`*[T1, T2: BaseObj](a: T1, b: T2): bool =
|
proc `==`*[T1, T2: BaseObj](a: T1, b: T2): bool =
|
||||||
echo "baseobj =="
|
echo "baseobj =="
|
||||||
|
|
@ -55,3 +58,11 @@ proc `==`*[T1, T2: BaseObj](a: T1, b: T2): bool =
|
||||||
let a = DerivedObj()
|
let a = DerivedObj()
|
||||||
let b = DerivedObj()
|
let b = DerivedObj()
|
||||||
echo a == b
|
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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue