diff options
author | Zahary Karadjov <zahary@gmail.com> | 2014-03-05 01:14:37 +0200 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2014-03-05 02:23:53 +0200 |
commit | 5324c9ebba1aa21c893db03c1d56d3ce1b42f162 (patch) | |
tree | e800cefb7f6ee456bfa19c1dd5e6004131c23ed1 /compiler/sigmatch.nim | |
parent | 016492375f149a0e71239845d55f8771e151299c (diff) | |
download | Nim-5324c9ebba1aa21c893db03c1d56d3ce1b42f162.tar.gz |
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.
Diffstat (limited to 'compiler/sigmatch.nim')
-rw-r--r-- | compiler/sigmatch.nim | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index f8e3459df..ce6120f08 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -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 |