Fix 105, few fixes for 101 (#11148)
This commit is contained in:
parent
20e3a39d6c
commit
45759b5e90
4 changed files with 7 additions and 4 deletions
|
|
@ -1035,7 +1035,7 @@ proc liftParamType(c: PContext, procKind: TSymKind, genericParams: PNode,
|
||||||
if lifted != nil: paramType.sons[i] = lifted
|
if lifted != nil: paramType.sons[i] = lifted
|
||||||
|
|
||||||
let body = paramType.base
|
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
|
# this may happen for proc type appearing in a type section
|
||||||
# before one of its param types
|
# before one of its param types
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -63,11 +63,10 @@ proc cacheTypeInst*(inst: PType) =
|
||||||
# update the refcount
|
# update the refcount
|
||||||
let gt = inst.sons[0]
|
let gt = inst.sons[0]
|
||||||
let t = if gt.kind == tyGenericBody: gt.lastSon else: gt
|
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
|
return
|
||||||
gt.sym.typeInstCache.add(inst)
|
gt.sym.typeInstCache.add(inst)
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
LayeredIdTable* = object
|
LayeredIdTable* = object
|
||||||
topLayer*: TIdTable
|
topLayer*: TIdTable
|
||||||
|
|
@ -363,6 +362,9 @@ proc handleGenericInvocation(cl: var TReplTypeVars, t: PType): PType =
|
||||||
# but we already raised an error!
|
# but we already raised an error!
|
||||||
rawAddSon(result, header.sons[i])
|
rawAddSon(result, header.sons[i])
|
||||||
|
|
||||||
|
if body.kind == tyError:
|
||||||
|
return
|
||||||
|
|
||||||
let bbody = lastSon body
|
let bbody = lastSon body
|
||||||
var newbody = replaceTypeVarsT(cl, bbody)
|
var newbody = replaceTypeVarsT(cl, bbody)
|
||||||
let bodyIsNew = newbody != bbody
|
let bodyIsNew = newbody != bbody
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,7 @@ proc elemType*(t: PType): PType =
|
||||||
case t.kind
|
case t.kind
|
||||||
of tyGenericInst, tyDistinct, tyAlias, tySink: result = elemType(lastSon(t))
|
of tyGenericInst, tyDistinct, tyAlias, tySink: result = elemType(lastSon(t))
|
||||||
of tyArray: result = t.sons[1]
|
of tyArray: result = t.sons[1]
|
||||||
|
of tyError: result = t
|
||||||
else: result = t.lastSon
|
else: result = t.lastSon
|
||||||
assert(result != nil)
|
assert(result != nil)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue