Allowing nil for distinct types where the base type is nilable

This commit is contained in:
Hans Raaf
2016-08-05 15:17:38 +02:00
parent 64663387db
commit e2e4df1702
2 changed files with 49 additions and 0 deletions

View File

@@ -900,6 +900,8 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation =
if sameDistinctTypes(f, a): result = isEqual
elif f.base.kind == tyAnything: result = isGeneric
elif c.coerceDistincts: result = typeRel(c, f.base, a)
elif a.kind == tyNil and f.base.kind in NilableTypes:
result = f.allowsNil
elif c.coerceDistincts: result = typeRel(c, f.base, a)
of tySet:
if a.kind == tySet: