tapioca icon indicating copy to clipboard operation
tapioca copied to clipboard

Annotations for classes with multiple sources

Open mmenanno opened this issue 1 year ago • 0 comments

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?

mmenanno avatar Mar 01 '24 15:03 mmenanno