test cases for the new handling of iterators by the is operator
This commit is contained in:
parent
862c0ef83d
commit
249dd70273
3 changed files with 36 additions and 9 deletions
|
|
@ -410,7 +410,10 @@ proc procTypeRel(c: var TCandidate, f, a: PType): TTypeRelation =
|
|||
return isNone
|
||||
when useEffectSystem:
|
||||
if not compatibleEffects(f, a): return isNone
|
||||
of tyNil: result = f.allowsNil
|
||||
of tyNil:
|
||||
result = f.allowsNil
|
||||
of tyIter:
|
||||
if tfIterator in f.flags: result = typeRel(c, f.base, a.base)
|
||||
else: discard
|
||||
|
||||
proc typeRangeRel(f, a: PType): TTypeRelation {.noinline.} =
|
||||
|
|
@ -923,8 +926,11 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation =
|
|||
result = isNone
|
||||
|
||||
of tyIter:
|
||||
if a.kind == f.kind: result = typeRel(c, f.base, a.base)
|
||||
else: result = isNone
|
||||
if a.kind == tyIter or
|
||||
(a.kind == tyProc and tfIterator in a.flags):
|
||||
result = typeRel(c, f.base, a.base)
|
||||
else:
|
||||
result = isNone
|
||||
|
||||
of tyStmt:
|
||||
result = isGeneric
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue