Exception: RBS::InconsistentClassModuleAliasError

Inherits:
BaseError
  • Object
show all
Includes:
DetailedMessageable
Defined in:
lib/rbs/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DetailedMessageable

#detailed_message

Constructor Details

#initialize(entry) ⇒ InconsistentClassModuleAliasError

Returns a new instance of InconsistentClassModuleAliasError.



512
513
514
515
516
517
518
519
520
521
522
523
524
# File 'lib/rbs/errors.rb', line 512

def initialize(entry)
  @alias_entry = entry

  expected_kind, actual_kind =
    case entry
    when Environment::ModuleAliasEntry
      ["module", "class"]
    when Environment::ClassAliasEntry
      ["class", "module"]
    end

  super "#{Location.to_string(entry.decl.location&.[](:old_name))}: A #{expected_kind} `#{entry.decl.new_name}` cannot be an alias of a #{actual_kind} `#{entry.decl.old_name}`"
end

Instance Attribute Details

#alias_entryObject (readonly)

Returns the value of attribute alias_entry.



510
511
512
# File 'lib/rbs/errors.rb', line 510

def alias_entry
  @alias_entry
end

Instance Method Details

#locationObject



526
527
528
# File 'lib/rbs/errors.rb', line 526

def location
  @alias_entry.decl.location
end