summary refs log tree commit diff stats
path: root/tests/usingstmt/tthis.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/usingstmt/tthis.nim')
-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