mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-18 13:30:33 +00:00
Fix 105, few fixes for 101 (#11148)
(cherry picked from commit 45759b5e90)
This commit is contained in:
@@ -92,6 +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)
|
||||
|
||||
proc importAllSymbolsExcept(c: PContext, fromMod: PSym, exceptSet: IntSet) =
|
||||
var i: TTabIter
|
||||
|
||||
@@ -972,7 +972,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
|
||||
|
||||
@@ -67,11 +67,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.safeAdd(inst)
|
||||
|
||||
|
||||
type
|
||||
LayeredIdTable* = object
|
||||
topLayer*: TIdTable
|
||||
@@ -336,6 +335,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
|
||||
|
||||
@@ -130,6 +130,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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user