lib/rbs/definition.rb in rbs-2.6.0 vs lib/rbs/definition.rb in rbs-2.7.0.pre.1
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module RBS
class Definition
class Variable
attr_reader :parent_variable
attr_reader :type
@@ -116,11 +118,11 @@
def method_types
@method_types ||= defs.map(&:type)
end
def comments
- @comments ||= _ = defs.map(&:comment).compact
+ @comments ||= defs.map(&:comment).compact.uniq
end
def annotations
@annotations ||= @extra_annotations + defs.flat_map {|d| d.annotations }
end
@@ -168,9 +170,19 @@
self.class.new(
super_method: super_method,
defs: defs.map {|defn| defn.update(type: yield(defn.type)) },
accessibility: @accessibility,
alias_of: alias_of
+ )
+ end
+
+ def update(super_method: self.super_method, defs: self.defs, accessibility: self.accessibility, alias_of: self.alias_of, annotations: self.annotations)
+ self.class.new(
+ super_method: super_method,
+ defs: defs,
+ accessibility: accessibility,
+ alias_of: alias_of,
+ annotations: annotations
)
end
end
module Ancestor