summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/lambdalifting.nim2
-rw-r--r--compiler/sem.nim5
-rw-r--r--compiler/semstmts.nim4
-rw-r--r--compiler/vm.nim2
-rw-r--r--todo.txt1
5 files changed, 11 insertions, 3 deletions
diff --git a/compiler/lambdalifting.nim b/compiler/lambdalifting.nim
index 11188267d..dd48a0bc3 100644
--- a/compiler/lambdalifting.nim
+++ b/compiler/lambdalifting.nim
@@ -207,6 +207,8 @@ proc newCall(a, b: PSym): PNode =
 
 proc addHiddenParam(routine: PSym, param: PSym) =
   var params = routine.ast.sons[paramsPos]
+  # -1 is correct here as param.position is 0 based but we have at position 0
+  # some nkEffect node:
   param.position = params.len-1
   addSon(params, newSymNode(param))
   incl(routine.typ.flags, tfCapturesEnv)
diff --git a/compiler/sem.nim b/compiler/sem.nim
index 89f87acaa..ee3df9f6a 100644
--- a/compiler/sem.nim
+++ b/compiler/sem.nim
@@ -187,6 +187,11 @@ proc semConstExpr(c: PContext, n: PNode): PNode =
         LocalError(e.info, errConstExprExpected)
       # error correction:
       result = e
+    else:
+      # recompute the types as 'eval' isn't guaranteed to construct types nor
+      # that the types are sound:
+      result = semExprWithType(c, result)
+      result = fitNode(c, e.typ, result)
 
 include hlo, seminst, semcall
 
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index 4fc69043b..441102989 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -421,7 +421,9 @@ proc semConst(c: PContext, n: PNode): PNode =
       def = fitRemoveHiddenConv(c, typ, def)
     else:
       typ = def.typ
-    if typ == nil: continue
+    if typ == nil:
+      LocalError(a.sons[2].info, errConstExprExpected)
+      continue
     if not typeAllowed(typ, skConst):
       LocalError(a.info, errXisNoType, typeToString(typ))
       continue
diff --git a/compiler/vm.nim b/compiler/vm.nim
index c70f8b41e..1596e4220 100644
--- a/compiler/vm.nim
+++ b/compiler/vm.nim
@@ -959,7 +959,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): PNode =
 
 proc fixType(result, n: PNode) {.inline.} =
   # XXX do it deeply for complex values
-  if result.typ.isNil: result.typ = n.typ
+  #if result.typ.isNil: result.typ = n.typ
 
 proc execute(c: PCtx, start: int): PNode =
   var tos = PStackFrame(prc: nil, comesFrom: 0, next: nil)
diff --git a/todo.txt b/todo.txt
index 94b3d5135..91df38a14 100644
--- a/todo.txt
+++ b/todo.txt
@@ -2,7 +2,6 @@ version 0.9.4
 =============
 
 - new VM:
-  - tcntseq fails
   - implement overflow checking
   - implement the FFI