Alan Wu ebb96fa880 Fix singleton class cloning
Before this commit, `clone` gave different results depending on whether the original object
had an attached singleton class or not.

Consider the following setup:
```
class Foo; end
Foo.singleton_class.define_method(:foo) {}

obj = Foo.new

obj.singleton_class if $call_singleton

clone = obj.clone
```

When `$call_singleton = false`, neither `obj.singleton_class.singleton_class` nor
`clone.singleton_class.singleton_class` own any methods.

However, when `$call_singleton = true`, `clone.singleton_class.singleton_class` would own a copy of
`foo` from `Foo.singleton_class`, even though `obj.singleton_class.singleton_class` does not.

The latter case is unexpected and results in a visibly different clone, depending on if the original object
had an attached class or not.

Co-authored-by: Ufuk Kayserilioglu <ufuk.kayserilioglu@shopify.com>
2020-11-16 17:41:17 -05:00
..
2020-10-27 23:26:38 +09:00
2020-09-08 20:39:23 +09:00
2020-10-06 17:11:08 -04:00
2020-07-18 19:33:11 +09:00
2020-11-16 17:41:17 -05:00
2020-10-15 14:12:02 +09:00
2020-11-11 09:27:36 +09:00