diff options
author | Hans Raaf <hara@oderwat.de> | 2016-08-05 15:17:38 +0200 |
---|---|---|
committer | Hans Raaf <hara@oderwat.de> | 2016-08-05 16:01:16 +0200 |
commit | e2e4df170281ca663fe023a551e2a97611a9ceca (patch) | |
tree | 7d17b005e4f4da516d04ec8d2616a471840a6676 /compiler/sigmatch.nim | |
parent | 64663387db4a447ee127571b47ef01d937f59785 (diff) | |
download | Nim-e2e4df170281ca663fe023a551e2a97611a9ceca.tar.gz |
Allowing `nil` for distinct types where the base type is nilable
Diffstat (limited to 'compiler/sigmatch.nim')
-rw-r--r-- | compiler/sigmatch.nim | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 19ef8a117..7cde101cb 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -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: |