summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/parser.nim4
-rw-r--r--tests/parser/tprecedence.nim5
2 files changed, 8 insertions, 1 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim
index 95ec5f765..7e934111a 100644
--- a/compiler/parser.nim
+++ b/compiler/parser.nim
@@ -2086,7 +2086,9 @@ proc parseConstant(p: var TParser): PNode =
       addSon(result, p.emptyNode)
   eat(p, tkEquals)
   optInd(p, result)
-  addSon(result, parseStmtListExpr(p))
+  #addSon(result, parseStmtListExpr(p))
+  addSon(result, parseExpr(p))
+  result[^1] = postExprBlocks(p, result[^1])
   indAndComment(p, result)
 
 proc parseBind(p: var TParser, k: TNodeKind): PNode =
diff --git a/tests/parser/tprecedence.nim b/tests/parser/tprecedence.nim
index 3e1c03dd1..66a2922db 100644
--- a/tests/parser/tprecedence.nim
+++ b/tests/parser/tprecedence.nim
@@ -49,3 +49,8 @@ let
   aaa = t 2 + 4
   ccc = t (1, 1) + 6
   ddd = t [0, 1, 2] + 5
+
+# bug #10896
+const
+  test =
+    proc(): int = 1