Exception: RBS::InheritModuleError

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(super_decl) ⇒ InheritModuleError

Returns a new instance of InheritModuleError.



162
163
164
165
166
# File 'lib/rbs/errors.rb', line 162

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.



160
161
162
# File 'lib/rbs/errors.rb', line 160

def super_decl
  @super_decl
end

Class Method Details

.check!(super_decl, env:) ⇒ Object



168
169
170
171
172
# File 'lib/rbs/errors.rb', line 168

def self.check!(super_decl, env:)
  return if env.class_decls[super_decl.name].is_a?(Environment::ClassEntry)

  raise new(super_decl)
end