Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite. This stack of pull requests is managed by Graphite. Learn more about stacking. |
cf42ec7 to
998bf60
Compare
f15c512 to
1c4ff1e
Compare
998bf60 to
59c4bd9
Compare
1c4ff1e to
d755cfd
Compare
b6129c3 to
0abbbcb
Compare
d755cfd to
4d2d914
Compare
0abbbcb to
9af9e46
Compare
aab5377 to
f0da94c
Compare
9af9e46 to
bbd649e
Compare
f0da94c to
ae69e75
Compare
bbd649e to
2a1f136
Compare
ae69e75 to
0b95499
Compare
a66d3fb to
860b7f9
Compare
0b95499 to
51dcab6
Compare
860b7f9 to
4d64604
Compare
51dcab6 to
2dae200
Compare
2dae200 to
b2735fd
Compare
4d64604 to
f744212
Compare
| #: self as Class[top] | ||
|
|
||
| if respond_to?(:__original_new_impl) # This is true for the abstract classes themselves, and false for their subclasses. | ||
| raise CannotInstantiateAbstractClassError, "#{self.class.name} is declared as abstract; it cannot be instantiated" |
There was a problem hiding this comment.
I think there's a bug here: self inside AbstractClass#new is the abstract class itself (e.g. Widget), so self.class is Class, not the abstract class. The error message would print "Class is declared as abstract" instead of the actual class name.
I wonder if we should use name instead?
| raise CannotInstantiateAbstractClassError, "#{self.class.name} is declared as abstract; it cannot be instantiated" | |
| raise CannotInstantiateAbstractClassError, "#{name} is declared as abstract; it cannot be instantiated" |
There was a problem hiding this comment.
True. I have to add tests for abstract class methods, and I'll verify their name is correct in the message.
| #: self as HasAbstractMethods & Module[top] | ||
|
|
||
| result = @__abstract_methods | ||
| result = @__abstract_methods #: Set[Symbol]? |
There was a problem hiding this comment.
My concern here is that result holds a direct reference to @__abstract_methods, so the subsequent result.merge(methods) on line 32 mutates the underlying ivar Set in place. After the first include_super: true call, @__abstract_methods would contain all ancestor methods too, meaning future calls would return incorrect (and growing) results.
I wonder if we should dup it here to avoid the mutation?
| result = @__abstract_methods #: Set[Symbol]? | |
| result = @__abstract_methods&.dup #: Set[Symbol]? |
There was a problem hiding this comment.
This hasn't been an issue with the current test suite, but I'll look into it!
b2735fd to
dac855d
Compare
f744212 to
9d75579
Compare
904ba88 to
a60ddb0
Compare
9d75579 to
66131d6
Compare
a60ddb0 to
a294201
Compare
66131d6 to
d460f28
Compare

No description provided.