mirror of
https://github.com/nim-lang/Nim.git
synced 2026-05-05 21:44:46 +00:00
added another test case for #6526
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user