Don't consider tyAnd/tyNot/tyOr/tyAnything as generic (#8700)

* Don't consider tyAnd/tyNot/tyOr/tyAnything as generic

`containsGenericType` was too shallow and didn't check all the branches.
The resulting half-processed nodes are often simplified by the constant
folding pass but when that's not possible we get a nasty error during
codegen.

Fixes #8693

* Move the blame onto the semFold pass

Slightly better evaluation of `is` forms.
This commit is contained in:
LemonBoy 2018-08-22 09:40:31 +02:00 • committed by Andreas Rumpf
commit a87341775a
3 changed files with 63 additions and 17 deletions

View file

@ -352,6 +352,11 @@ proc isOpImpl(c: PContext, n: PNode, flags: TExprFlags): PNode =
res = t.kind == tyProc and
t.callConv == ccClosure and
tfIterator notin t.flags
of "iterator":
let t = skipTypes(t1, abstractRange)
res = t.kind == tyProc and
t.callConv == ccClosure and
tfIterator in t.flags
else:
res = false
else: