Method: RBS::RecursiveAncestorError#initialize

Defined in:
lib/rbs/errors.rb

#initialize(ancestors:, location:) ⇒ RecursiveAncestorError

Returns a new instance of RecursiveAncestorError.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/rbs/errors.rb', line 70

def initialize(ancestors:, location:)
  last = case last = ancestors.last
         when Definition::Ancestor::Singleton
           "singleton(#{last.name})"
         when Definition::Ancestor::Instance
           if last.args.empty?
             last.name.to_s
           else
             "#{last.name}[#{last.args.join(", ")}]"
           end
         end

  super "#{Location.to_string location}: Detected recursive ancestors: #{last}"
end