summary refs log tree commit diff stats
path: root/compiler/trees.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/trees.nim')
-rw-r--r--compiler/trees.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/trees.nim b/compiler/trees.nim
index b1edd21f3..86a1139a0 100644
--- a/compiler/trees.nim
+++ b/compiler/trees.nim
@@ -117,7 +117,9 @@ proc isDeepConstExpr*(n: PNode): bool =
   of nkCurly, nkBracket, nkPar, nkObjConstr, nkClosure:
     for i in 0 .. <n.len:
       if not isDeepConstExpr(n.sons[i]): return false
-    result = true
+    # XXX once constant objects are supported by the codegen this needs to be
+    # weakened:
+    result = n.typ.isNil or n.typ.skipTypes({tyGenericInst, tyDistinct}).kind != tyObject
   else: discard
 
 proc flattenTreeAux(d, a: PNode, op: TMagic) =