fix issue #3550
This commit is contained in:
parent
86bb9d8b47
commit
3c557a0144
2 changed files with 20 additions and 4 deletions
|
|
@ -19,10 +19,7 @@ proc genConv(n: PNode, d: PType, downcast: bool): PNode =
|
||||||
if (source.kind == tyObject) and (dest.kind == tyObject):
|
if (source.kind == tyObject) and (dest.kind == tyObject):
|
||||||
var diff = inheritanceDiff(dest, source)
|
var diff = inheritanceDiff(dest, source)
|
||||||
if diff == high(int):
|
if diff == high(int):
|
||||||
# see bug #3550 which triggers it. XXX This is a hack but I don't know yet
|
# no subtype relation, nothing to do
|
||||||
# how the real fix looks like:
|
|
||||||
localError(n.info, "there is no subtype relation between " &
|
|
||||||
typeToString(d) & " and " & typeToString(n.typ))
|
|
||||||
result = n
|
result = n
|
||||||
elif diff < 0:
|
elif diff < 0:
|
||||||
result = newNodeIT(nkObjUpConv, n.info, d)
|
result = newNodeIT(nkObjUpConv, n.info, d)
|
||||||
|
|
|
||||||
19
tests/method/tmultim8.nim
Normal file
19
tests/method/tmultim8.nim
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
|
||||||
|
# bug #3550
|
||||||
|
|
||||||
|
type
|
||||||
|
BaseClass = ref object of RootObj
|
||||||
|
Class1 = ref object of BaseClass
|
||||||
|
Class2 = ref object of BaseClass
|
||||||
|
|
||||||
|
method test(obj: Class1, obj2: BaseClass) =
|
||||||
|
discard
|
||||||
|
|
||||||
|
method test(obj: Class2, obj2: BaseClass) =
|
||||||
|
discard
|
||||||
|
|
||||||
|
var obj1 = Class1()
|
||||||
|
var obj2 = Class2()
|
||||||
|
|
||||||
|
obj1.test(obj2)
|
||||||
|
obj2.test(obj1)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue