diff options
Diffstat (limited to 'compiler/semfold.nim')
-rw-r--r-- | compiler/semfold.nim | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/compiler/semfold.nim b/compiler/semfold.nim index 58239d23e..84cb0071f 100644 --- a/compiler/semfold.nim +++ b/compiler/semfold.nim @@ -594,8 +594,11 @@ proc foldConStrStr(m: PSym, n: PNode): PNode = proc newSymNodeTypeDesc*(s: PSym; info: TLineInfo): PNode = result = newSymNode(s, info) - result.typ = newType(tyTypeDesc, s.owner) - result.typ.addSonSkipIntLit(s.typ) + if s.typ.kind != tyTypeDesc: + result.typ = newType(tyTypeDesc, s.owner) + result.typ.addSonSkipIntLit(s.typ) + else: + result.typ = s.typ proc getConstExpr(m: PSym, n: PNode): PNode = result = nil @@ -634,9 +637,11 @@ proc getConstExpr(m: PSym, n: PNode): PNode = result = newSymNodeTypeDesc(s, n.info) of skGenericParam: if s.typ.kind == tyStatic: - if s.typ.n != nil: + if s.typ.n != nil and tfUnresolved notin s.typ.flags: result = s.typ.n - result.typ = s.typ.sons[0] + result.typ = s.typ.base + elif s.typ.isIntLit: + result = s.typ.n else: result = newSymNodeTypeDesc(s, n.info) else: discard |