diff options
author | genotrance <dev@genotrance.com> | 2019-05-04 15:38:52 -0500 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-05-04 22:38:52 +0200 |
commit | 45759b5e904380554dc590ee87e56b61d5a17cf2 (patch) | |
tree | 270af88c93591a2372eaa58e385461ba3236bc1b | |
parent | 20e3a39d6c9bee419f133f87920724d3d45e93d9 (diff) | |
download | Nim-45759b5e904380554dc590ee87e56b61d5a17cf2.tar.gz |
Fix 105, few fixes for 101 (#11148)
-rw-r--r-- | compiler/importer.nim | 2 | ||||
-rw-r--r-- | compiler/semtypes.nim | 2 | ||||
-rw-r--r-- | compiler/semtypinst.nim | 6 | ||||
-rw-r--r-- | compiler/types.nim | 1 |
4 files changed, 7 insertions, 4 deletions
diff --git a/compiler/importer.nim b/compiler/importer.nim index eef0c9bb9..da35837cc 100644 --- a/compiler/importer.nim +++ b/compiler/importer.nim @@ -92,7 +92,7 @@ proc importSymbol(c: PContext, n: PNode, fromMod: PSym) = rawImportSymbol(c, e) e = nextIdentIter(it, fromMod.tab) else: rawImportSymbol(c, s) - suggestSym(c.config, n.info, s, c.graph.usageSym, false) + suggestSym(c.config, n.info, s, c.graph.usageSym, false) proc importAllSymbolsExcept(c: PContext, fromMod: PSym, exceptSet: IntSet) = var i: TTabIter diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index d0c8c8520..bd64af729 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -1035,7 +1035,7 @@ proc liftParamType(c: PContext, procKind: TSymKind, genericParams: PNode, if lifted != nil: paramType.sons[i] = lifted let body = paramType.base - if body.kind == tyForward: + if body.kind in {tyForward, tyError}: # this may happen for proc type appearing in a type section # before one of its param types return diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim index 5d2c4203c..18e59681d 100644 --- a/compiler/semtypinst.nim +++ b/compiler/semtypinst.nim @@ -63,11 +63,10 @@ proc cacheTypeInst*(inst: PType) = # update the refcount let gt = inst.sons[0] let t = if gt.kind == tyGenericBody: gt.lastSon else: gt - if t.kind in {tyStatic, tyGenericParam} + tyTypeClasses: + if t.kind in {tyStatic, tyError, tyGenericParam} + tyTypeClasses: return gt.sym.typeInstCache.add(inst) - type LayeredIdTable* = object topLayer*: TIdTable @@ -363,6 +362,9 @@ proc handleGenericInvocation(cl: var TReplTypeVars, t: PType): PType = # but we already raised an error! rawAddSon(result, header.sons[i]) + if body.kind == tyError: + return + let bbody = lastSon body var newbody = replaceTypeVarsT(cl, bbody) let bodyIsNew = newbody != bbody diff --git a/compiler/types.nim b/compiler/types.nim index a1cd85d04..199bd3352 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -123,6 +123,7 @@ proc elemType*(t: PType): PType = case t.kind of tyGenericInst, tyDistinct, tyAlias, tySink: result = elemType(lastSon(t)) of tyArray: result = t.sons[1] + of tyError: result = t else: result = t.lastSon assert(result != nil) |