Exception: RBS::InvalidOverloadMethodError

Inherits:
DefinitionError show all
Includes:
DetailedMessageable
Defined in:
sig/errors.rbs,
lib/rbs/errors.rb

Overview

The overloading method definition cannot find non-overloading method definition

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DetailedMessageable

#detailed_message

Constructor Details

#initialize(type_name:, method_name:, kind:, members:) ⇒ InvalidOverloadMethodError

Returns a new instance of InvalidOverloadMethodError.

Parameters:

  • type_name: (TypeName)
  • method_name: (Symbol)
  • kind: (:instance, :singleton)
  • members: (Array[member])


386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
# File 'lib/rbs/errors.rb', line 386

def initialize(type_name:, method_name:, kind:, members:)
  @type_name = type_name
  @method_name = method_name
  @kind = kind
  @members = members

  delimiter = case kind
              when :instance
                "#"
              when :singleton
                "."
              end

  super "#{Location.to_string members[0].location}: Invalid method overloading: #{type_name}#{delimiter}#{method_name}"
end

Instance Attribute Details

#kind:instance, :singleton (readonly)

Returns the value of attribute kind.

Returns:

  • (:instance, :singleton)


383
384
385
# File 'lib/rbs/errors.rb', line 383

def kind
  @kind
end

#membersArray[member] (readonly)

Returns the value of attribute members.

Returns:

  • (Array[member])


384
385
386
# File 'lib/rbs/errors.rb', line 384

def members
  @members
end

#method_nameSymbol (readonly)

Returns the value of attribute method_name.

Returns:

  • (Symbol)


382
383
384
# File 'lib/rbs/errors.rb', line 382

def method_name
  @method_name
end

#type_nameTypeName (readonly)

Returns the value of attribute type_name.

Returns:



381
382
383
# File 'lib/rbs/errors.rb', line 381

def type_name
  @type_name
end

Instance Method Details

#locationAST::Members::MethodDefinition::loc?

Returns:

  • (AST::Members::MethodDefinition::loc, nil)


402
403
404
# File 'lib/rbs/errors.rb', line 402

def location
  members[0].location
end