Fix incorrect extend T::Helpers for foreign annotations#750
Conversation
c73f532 to
67b86a0
Compare
extend T::Helpers for foreign annotations
| when "@abstract" | ||
| true | ||
| when "@interface" | ||
| true | ||
| when "@sealed" | ||
| true | ||
| when "@final" | ||
| true | ||
| when /^@requires_ancestor: / | ||
| true |
There was a problem hiding this comment.
I think we can put multiple cases together like:
| when "@abstract" | |
| true | |
| when "@interface" | |
| true | |
| when "@sealed" | |
| true | |
| when "@final" | |
| true | |
| when /^@requires_ancestor: / | |
| true | |
| when "@abstract", "@interface", "@sealed", "@final" | |
| true | |
| when /^@requires_ancestor: / | |
| true |
Regexp and string matches can be put together too, but I think giving the regexp match its own condition can make it easier to spot.
| when "@without_runtime" | ||
| true | ||
| else | ||
| false |
|
|
||
| #: -> Array[Annotation] | ||
| def class_annotations | ||
| @annotations.select do |annotation| |
There was a problem hiding this comment.
Is it worth memoizing this value?
There was a problem hiding this comment.
Do you mean annotations or the resulting array from select?
There was a problem hiding this comment.
Should it change if we already started the translation?
There was a problem hiding this comment.
Should they: no. Can they?
I'm generally uneasy with memoization based on array attributes because they can change even with an attr_reader and there is no obvious cut point to freeze them.
There was a problem hiding this comment.
That's fair and I'm fine with not memorizing as it doesn't seem to be a performance bottleneck anyway 👍
Co-authored-by: Alexandre Terrasa <583144+Morriar@users.noreply.github.com>
67b86a0 to
e2e6370
Compare
Ran into some gems that specify
# @privatewhich was causing us to insertextend T::Sig.Also a small refactor
Annotations -> Annotation