iterators now return tyIter(T);
tyIter(T) represents an "iteration yielding values of type T" I'm planning to use that in the context of the `is` operator supporting predicates such as `C.items is iterator` and also in the upcoming support for higher-order inline iterators.
This commit is contained in:
parent
016492375f
commit
5324c9ebba
6 changed files with 18 additions and 11 deletions
|
|
@ -921,14 +921,18 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation =
|
|||
result = typeRel(c, prev.base, a.base)
|
||||
else:
|
||||
result = isNone
|
||||
|
||||
|
||||
of tyIter:
|
||||
if a.kind == f.kind: result = typeRel(c, f.base, a.base)
|
||||
else: result = isNone
|
||||
|
||||
of tyStmt:
|
||||
result = isGeneric
|
||||
|
||||
of tyProxy:
|
||||
result = isEqual
|
||||
|
||||
else: internalError("typeRel: " & $f.kind)
|
||||
else: internalAssert false
|
||||
|
||||
proc cmpTypes*(c: PContext, f, a: PType): TTypeRelation =
|
||||
var m: TCandidate
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue