123456789_123456789_123456789_123456789_123456789_

Exception: RBS::TypeParamDefaultReferenceError

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, DefinitionError, BaseError, StandardError
Instance Chain:
Inherits: RBS::DefinitionError
Defined in: lib/rbs/errors.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(type_param, location:) ⇒ TypeParamDefaultReferenceError

[ GitHub ]

  
# File 'lib/rbs/errors.rb', line 586

def initialize(type_param, location:)
  super "#{Location.to_string(location)}: the default of #{type_param.name} cannot include optional type parameter"
  @location = location
  @type_param = type_param
end

Class Method Details

.check!(type_params)

[ GitHub ]

  
# File 'lib/rbs/errors.rb', line 592

def self.check!(type_params)
  if errors = AST::TypeParam.validate(type_params)
    error = errors[0] or raise
    error.default_type or raise
    raise new(error, location: error.default_type.location)
  end
end

Instance Attribute Details

#location (readonly)

[ GitHub ]

  
# File 'lib/rbs/errors.rb', line 584

attr_reader :location

#type_param (readonly)

[ GitHub ]

  
# File 'lib/rbs/errors.rb', line 583

attr_reader :type_param