Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inheritable placement not symmetric between object and ref object #3012

Closed
arnetheduck opened this issue Jun 28, 2015 · 4 comments

Comments

Projects
None yet
4 participants
@arnetheduck
Copy link
Contributor

commented Jun 28, 2015

In the following snippet, 3 out of 4 placements work for inheritable, but one oddly does not, causing a surprising asymmetry between object and ref object:

type
  A {.inheritable.} = object
  B = ref object {. inheritable .}
  C {.inheritable.} = ref object
  D = object {.inheritable.}

type
  AA = ref object of A
  BB = ref object of B
  # Error: inheritance only works with non-final objects
  # CC = ref object of C
  DD = ref object of D
@Araq

This comment has been minimized.

Copy link
Member

commented Jun 29, 2015

Not that surprising as C is an "inheritable ref object"...

@apense

This comment has been minimized.

Copy link
Contributor

commented Jun 29, 2015

Is this related to #2926 at all?

@andreaferretti

This comment has been minimized.

Copy link
Collaborator

commented Aug 8, 2018

The error message was improved to Error: inheritance only works with non-final objects; to enable inheritance write 'C of RootObj'

@andreaferretti

This comment has been minimized.

Copy link
Collaborator

commented Feb 27, 2019

Seems to compile with latest nim (ca4b971)

@narimiran narimiran closed this in 588610b Feb 27, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.