fixes #7600, generic object with generic ref object parent typerel bug (#7678)

* fixes #7600

* fix wrong logic
This commit is contained in:
andri lim 2018-04-27 13:53:20 +07:00 • committed by Andreas Rumpf
commit e4aa140d22
3 changed files with 42 additions and 2 deletions

View file

@ -1388,8 +1388,13 @@ proc typeRelImpl(c: var TCandidate, f, aOrig: PType,
var aAsObject = roota.lastSon
if fKind in {tyRef, tyPtr} and aAsObject.kind == fKind:
aAsObject = aAsObject.base
if fKind in {tyRef, tyPtr}:
if aAsObject.kind == tyObject:
# bug #7600, tyObject cannot be passed
# as argument to tyRef/tyPtr
return isNone
elif aAsObject.kind == fKind:
aAsObject = aAsObject.base
if aAsObject.kind == tyObject:
let baseType = aAsObject.base