This commit is contained in:
zah 2017-03-17 18:11:37 +02:00 • committed by Andreas Rumpf
commit a20a8e6adb
2 changed files with 22 additions and 2 deletions

View file

@ -1086,8 +1086,12 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation =
of tyBuiltInTypeClass:
considerPreviousT:
let targetKind = f.sons[0].kind
if targetKind == a.skipTypes({tyRange, tyGenericInst, tyBuiltInTypeClass, tyAlias}).kind or
(targetKind in {tyProc, tyPointer} and a.kind == tyNil):
let effectiveArgType = a.skipTypes({tyRange, tyGenericInst,
tyBuiltInTypeClass, tyAlias})
let typeClassMatches = targetKind == effectiveArgType.kind and
not effectiveArgType.isEmptyContainer
if typeClassMatches or
(targetKind in {tyProc, tyPointer} and effectiveArgType.kind == tyNil):
put(c, f, a)
return isGeneric
else: