Annotations for classes with multiple sources
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 873
- Forks
- 164
- Avg merge
- 4d 27m
- Merged PRs (30d)
- 9
Description
I noticed in the rbi generated for activesupport, the source annotation above classes in core_ext can be only partially true, because it is picking a single source when there is multiple. For instance here
# source://activesupport//lib/active_support/core_ext/object/blank.rb#61
class FalseClass
# source://activesupport//lib/active_support/core_ext/object/json.rb#89
def as_json(options = T.unsafe(nil)); end
# +false+ is blank:
#
# false.blank? # => true
#
# @return [true]
#
# source://activesupport//lib/active_support/core_ext/object/blank.rb#67
def blank?; end
# Returns +self+.
#
# source://activesupport//lib/active_support/core_ext/object/to_query.rb#34
def to_param; end
end
You can see that it lists the source as source://activesupport//lib/active_support/core_ext/object/blank.rb#61 for the class, but if you look at the methods below it you can quickly see all the other places this class is actually defined. While this is a bit of an edge case, perhaps when there are multiple we should have multiple source lines for the class?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the generated ActiveSupport RBI shown in sorbet/rbi/gems/activesupport@7.1.3.2.rbi, especially FalseClass and its core_ext/object source annotations. Trace the RBI generation path that selects a class source, then verify that classes defined in multiple files retain all relevant source lines in the generated output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100