From 275c7ccf82e03622258c135890c0419e70ee0884 Mon Sep 17 00:00:00 2001 From: Araq Date: Tue, 10 Sep 2013 22:04:12 +0200 Subject: fixes #575 --- tests/run/tobjasgn.nim | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tests/run/tobjasgn.nim (limited to 'tests/run/tobjasgn.nim') diff --git a/tests/run/tobjasgn.nim b/tests/run/tobjasgn.nim new file mode 100644 index 000000000..5f411063f --- /dev/null +++ b/tests/run/tobjasgn.nim @@ -0,0 +1,39 @@ +discard """ + output: '''0 +pre test a:test b:1 c:2 haha:3 +assignment test a:test b:1 c:2 haha:3 +''' +""" + +type TSomeObj = object of TObject + Variable: int + +var a = TSomeObj() + +echo a.Variable.`$` + +# bug #575 + +type + Something = object of Tobject + a: string + b, c: int32 + +type + Other = object of Something + haha: int + +proc `$`(x: Other): string = + result = "a:" & x.a & " b:" & $x.b & " c:" & $x.c & " haha:" & $x.haha + +var + t: Other + +t.a = "test" +t.b = 1 +t.c = 2 +t.haha = 3 + +echo "pre test ", $t +var x = t +echo "assignment test ", x -- cgit 1.4.1-2-gfad0