summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/semexprs.nim1
-rw-r--r--tests/compile/tobjconstr2.nim14
2 files changed, 15 insertions, 0 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index 4d7ceffa9..d00490d2a 100644
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -1672,6 +1672,7 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode =
     var
       check: PNode = nil
       f: PSym
+    t = objType
     while true:
       check = nil
       f = lookupInRecordAndBuildCheck(c, it, t.n, id, check)
diff --git a/tests/compile/tobjconstr2.nim b/tests/compile/tobjconstr2.nim
index ef5446999..cb47e146d 100644
--- a/tests/compile/tobjconstr2.nim
+++ b/tests/compile/tobjconstr2.nim
@@ -6,3 +6,17 @@ var s{.exportc.}: seq[TFoo] = @[]
 s.add TFoo(x: 42)
 
 echo s[0].x
+
+
+# bug #563
+type
+  Foo =
+    object {.inheritable.}
+      x: int
+
+  Bar =
+    object of Foo
+      y: int
+
+var a = Bar(y: 100, x: 200) # works
+var b = Bar(x: 100, y: 200) # used to fail