Exception: RBS::MixinClassError

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DetailedMessageable

#detailed_message

Constructor Details

#initialize(type_name:, member:) ⇒ MixinClassError

Returns a new instance of MixinClassError.



449
450
451
452
453
454
# File 'lib/rbs/errors.rb', line 449

def initialize(type_name:, member:)
  @type_name = type_name
  @member = member

  super "#{Location.to_string member.location}: Cannot #{mixin_name} a class `#{member.name}` in the definition of `#{type_name}`"
end

Instance Attribute Details

#memberObject (readonly)

Returns the value of attribute member.



447
448
449
# File 'lib/rbs/errors.rb', line 447

def member
  @member
end

#type_nameObject (readonly)

Returns the value of attribute type_name.



446
447
448
# File 'lib/rbs/errors.rb', line 446

def type_name
  @type_name
end

Class Method Details

.check!(type_name:, env:, member:) ⇒ Object



460
461
462
463
464
# File 'lib/rbs/errors.rb', line 460

def self.check!(type_name:, env:, member:)
  if env.class_decl?(member.name)
    raise new(type_name: type_name, member: member)
  end
end

Instance Method Details

#locationObject



456
457
458
# File 'lib/rbs/errors.rb', line 456

def location
  member.location
end