Exception: RBS::InheritModuleError

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(super_decl) ⇒ InheritModuleError

Returns a new instance of InheritModuleError.



177
178
179
180
181
# File 'lib/rbs/errors.rb', line 177

def initialize(super_decl)
  @super_decl = super_decl

  super "#{Location.to_string(super_decl.location)}: Cannot inherit a module: #{super_decl.name}"
end

Instance Attribute Details

#super_declObject (readonly)

Returns the value of attribute super_decl.



175
176
177
# File 'lib/rbs/errors.rb', line 175

def super_decl
  @super_decl
end

Class Method Details

.check!(super_decl, env:) ⇒ Object



187
188
189
190
191
# File 'lib/rbs/errors.rb', line 187

def self.check!(super_decl, env:)
  return if env.class_decl?(super_decl.name) || env.class_alias?(super_decl.name)

  raise new(super_decl)
end

Instance Method Details

#locationObject



183
184
185
# File 'lib/rbs/errors.rb', line 183

def location
  @super_decl.location
end