summary refs log tree commit diff stats
path: root/compiler/semstmts.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-09-05 01:17:03 +0200
committerAraq <rumpf_a@web.de>2014-09-05 01:17:03 +0200
commitbd4e2294640c634027f7a15d2a07eea21808dc61 (patch)
tree98d1f66e53ac305e1fbc249da4c65e19bb10789a /compiler/semstmts.nim
parentbf557a7cdb8f31aabca17d5b147a90ec155eaf23 (diff)
parent7d5e387a488200113664a3ffa60e5c63ec32c54b (diff)
downloadNim-bd4e2294640c634027f7a15d2a07eea21808dc61.tar.gz
Merge branch 'bigbreak' of https://github.com/Araq/Nimrod into bigbreak
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r--compiler/semstmts.nim11
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index 28d062392..93a1994a7 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -350,9 +350,14 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode =
     var def: PNode
     if a.sons[length-1].kind != nkEmpty:
       def = semExprWithType(c, a.sons[length-1], {efAllowDestructor})
-      # BUGFIX: ``fitNode`` is needed here!
-      # check type compability between def.typ and typ:
-      if typ != nil: def = fitNode(c, typ, def)
+      if typ != nil:
+        if typ.isMetaType:
+          def = inferWithMetaType(c, typ, def)
+          typ = def.typ
+        else:
+          # BUGFIX: ``fitNode`` is needed here!
+          # check type compability between def.typ and typ        
+          def = fitNode(c, typ, def)
       else:
         typ = skipIntLit(def.typ)
         if typ.kind in {tySequence, tyArray, tySet} and