tthis.nim 331 B

12345678910111213141516
  1. # bug #4177
  2. type
  3. Parent = object of RootObj
  4. parentField: int
  5. Child = object of Parent
  6. childField: int
  7. {.this: self.}
  8. proc sumFields(self: Child): int =
  9. result = parentField + childField # Error: undeclared identifier: 'parentField'
  10. proc sumFieldsWorks(self: Child): int =
  11. result = self.parentField + childField