summary refs log tree commit diff stats
path: root/tests/usingstmt
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-05-28 22:40:28 +0200
committerAndreas Rumpf <rumpf_a@web.de>2016-05-28 22:40:28 +0200
commite65c89ee28a8b03e00f5dba9ff181918764d72c0 (patch)
tree5f01f713d85dd8f502e7873248782b30c3fb9bfb /tests/usingstmt
parentab08ee1ce63a0f8f48026aeeaf07a8a9236ca17e (diff)
downloadNim-e65c89ee28a8b03e00f5dba9ff181918764d72c0.tar.gz
fixes #4177
Diffstat (limited to 'tests/usingstmt')
-rw-r--r--tests/usingstmt/tthis.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/usingstmt/tthis.nim b/tests/usingstmt/tthis.nim
new file mode 100644
index 000000000..83d75d08c
--- /dev/null
+++ b/tests/usingstmt/tthis.nim
@@ -0,0 +1,15 @@
+
+# bug #4177
+
+type
+  Parent = object of RootObj
+    parentField: int
+  Child = object of Parent
+    childField: int
+
+{.this: self.}
+proc sumFields(self: Child): int =
+  result = parentField + childField # Error: undeclared identifier: 'parentField'
+
+proc sumFieldsWorks(self: Child): int =
+  result = self.parentField + childField