#adoptInstance: bug?

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

#adoptInstance: bug?

Levente Uzonyi
Hi All,

I recently found a bug(?) with #adoptInstance: (primitive 160).
If you create a variable class, let's call it A, and a subclass of it, B,
where B has an instance variable called foo, then

  B adoptInstance: (A new: 1)

will fail with error code #'bad receiver', which is fine, because B needs
more slots than A, but

  A adoptInstance: (B new: 1)

will succeed. The resulting object will have 2 indexable slots instead of
1, because the instance variable will be converted to an indexable slot.
Is this the expected behavior? (primitive 115 does the same)