Exception: RBS::InvalidTypeApplicationError
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
DefinitionError ,
BaseError ,
StandardError
|
|
Instance Chain:
self,
DefinitionError ,
BaseError ,
StandardError
|
|
Inherits: |
RBS::DefinitionError
|
Defined in: | lib/rbs/errors.rb |
Class Method Summary
Instance Attribute Summary
- #args readonly
- #location readonly
- #params readonly
- #type_name readonly
- #type_params readonly
Constructor Details
.new(type_name:, args:, params:, location:) ⇒ InvalidTypeApplicationError
# File 'lib/rbs/errors.rb', line 74
def initialize(type_name:, args:, params:, location:) @type_name = type_name @args = args @type_params = params @params = params.map(&:name) @location = location super "#{Location.to_string location}: #{type_name} expects parameters [#{params.join(", ")}], but given args [#{args.join(", ")}]" end
Class Method Details
.check!(type_name:, args:, params:, location:)
[ GitHub ]# File 'lib/rbs/errors.rb', line 83
def self.check!(type_name:, args:, params:, location:) min_arity = params.count { _1.default_type.nil? } max_arity = params.size unless min_arity <= args.size && args.size <= max_arity raise new(type_name: type_name, args: args, params: params, location: location) end end
.check2!(env:, type_name:, args:, location:)
[ GitHub ]# File 'lib/rbs/errors.rb', line 92
def self.check2!(env:, type_name:, args:, location:) params = case when type_name.class? decl = env.normalized_module_class_entry(type_name) or raise decl.type_params when type_name.interface? env.interface_decls.fetch(type_name).decl.type_params when type_name.alias? env.type_alias_decls.fetch(type_name).decl.type_params else raise end check!(type_name: type_name, args: args, params: params, location: location) end
Instance Attribute Details
#args (readonly)
[ GitHub ]# File 'lib/rbs/errors.rb', line 69
attr_reader :args
#location (readonly)
[ GitHub ]# File 'lib/rbs/errors.rb', line 72
attr_reader :location
#params (readonly)
[ GitHub ]# File 'lib/rbs/errors.rb', line 70
attr_reader :params
#type_name (readonly)
[ GitHub ]# File 'lib/rbs/errors.rb', line 68
attr_reader :type_name
#type_params (readonly)
[ GitHub ]# File 'lib/rbs/errors.rb', line 71
attr_reader :type_params