mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-30 18:41:45 +00:00
Allowing nil for distinct types where the base type is nilable
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user