From fa3bb8d66bfa18c3a497db2945df43703d809adc Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Mon, 30 Dec 2013 00:03:57 +0200 Subject: restore return type inference --- compiler/ast.nim | 3 +++ compiler/semexprs.nim | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'compiler') diff --git a/compiler/ast.nim b/compiler/ast.nim index 6f30522a2..22b17f673 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -905,6 +905,9 @@ template `{}=`*(n: PNode, i: int, s: PNode): stmt = var emptyNode* = newNode(nkEmpty) # There is a single empty node that is shared! Do not overwrite it! +proc isMetaType*(t: PType): bool = + return t.kind in tyMetaTypes or tfHasMeta in t.flags + proc linkTo*(t: PType, s: PSym): PType {.discardable.} = t.sym = s s.typ = t diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 4e53a5389..14f611c5c 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1164,7 +1164,7 @@ proc semAsgn(c: PContext, n: PNode): PNode = if lhsIsResult: {efAllowDestructor} else: {}) if lhsIsResult: n.typ = enforceVoidContext - if lhs.sym.typ.kind == tyGenericParam: + if lhs.sym.typ.isMetaType: if cmpTypes(c, lhs.typ, rhs.typ) == isGeneric: internalAssert c.p.resultSym != nil lhs.typ = rhs.typ -- cgit 1.4.1-2-gfad0