diff options
-rw-r--r-- | compiler/semfold.nim | 5 | ||||
-rw-r--r-- | compiler/transf.nim | 10 | ||||
-rw-r--r-- | tests/overload/tprefer_tygenericinst.nim | 2 |
3 files changed, 11 insertions, 6 deletions
diff --git a/compiler/semfold.nim b/compiler/semfold.nim index 05e398c9a..7a65462ec 100644 --- a/compiler/semfold.nim +++ b/compiler/semfold.nim @@ -628,7 +628,10 @@ proc getConstExpr(m: PSym, n: PNode): PNode = of {skProc, skMethod}: result = n of skType: - result = newSymNodeTypeDesc(s, n.info) + # XXX gensym'ed symbols can come here and cannot be resolved. This is + # dirty, but correct. + if s.typ != nil: + result = newSymNodeTypeDesc(s, n.info) of skGenericParam: if s.typ.kind == tyStatic: if s.typ.n != nil: diff --git a/compiler/transf.nim b/compiler/transf.nim index cbd1f15e3..2103d48bf 100644 --- a/compiler/transf.nim +++ b/compiler/transf.nim @@ -869,10 +869,12 @@ proc transform(c: PTransf, n: PNode): PTransNode = else: result = transformSons(c, n) of nkIdentDefs, nkConstDef: - result = n.PTransNode - #transformSons(c, n) - let L = n.len-1 - result[L] = transform(c, n.sons[L]) + when true: + result = transformSons(c, n) + else: + result = n.PTransNode + let L = n.len-1 + result[L] = transform(c, n.sons[L]) # XXX comment handling really sucks: if importantComments(): PNode(result).comment = n.comment diff --git a/tests/overload/tprefer_tygenericinst.nim b/tests/overload/tprefer_tygenericinst.nim index 9787af06b..56541c7e8 100644 --- a/tests/overload/tprefer_tygenericinst.nim +++ b/tests/overload/tprefer_tygenericinst.nim @@ -19,7 +19,7 @@ when true: q(B()) # This call reported as ambiguous. # bug #2219 -template testPred(a: expr) = +template testPred(a: untyped) = block: type A = object of RootObj type B = object of A |