Exception: RBS::InvalidTypeApplicationError

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(type_name:, args:, params:, location:) ⇒ InvalidTypeApplicationError

Returns a new instance of InvalidTypeApplicationError.



55
56
57
58
59
60
61
# File 'lib/rbs/errors.rb', line 55

def initialize(type_name:, args:, params:, location:)
  @type_name = type_name
  @args = args
  @params = params
  @location = location
  super "#{Location.to_string location}: #{type_name} expects parameters [#{params.join(", ")}], but given args [#{args.join(", ")}]"
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



51
52
53
# File 'lib/rbs/errors.rb', line 51

def args
  @args
end

#locationObject (readonly)

Returns the value of attribute location.



53
54
55
# File 'lib/rbs/errors.rb', line 53

def location
  @location
end

#paramsObject (readonly)

Returns the value of attribute params.



52
53
54
# File 'lib/rbs/errors.rb', line 52

def params
  @params
end

#type_nameObject (readonly)

Returns the value of attribute type_name.



50
51
52
# File 'lib/rbs/errors.rb', line 50

def type_name
  @type_name
end

Class Method Details

.check!(type_name:, args:, params:, location:) ⇒ Object



63
64
65
66
67
# File 'lib/rbs/errors.rb', line 63

def self.check!(type_name:, args:, params:, location:)
  unless args.size == params.size
    raise new(type_name: type_name, args: args, params: params, location: location)
  end
end