Exception: RBS::InvalidVarianceAnnotationError
- Inherits:
-
StandardError
- Object
- StandardError
- RBS::InvalidVarianceAnnotationError
- Defined in:
- lib/rbs/errors.rb
Defined Under Namespace
Classes: InheritanceError, MethodTypeError, MixinError
Instance Attribute Summary collapse
-
#decl ⇒ Object
readonly
Returns the value of attribute decl.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(decl:, errors:) ⇒ InvalidVarianceAnnotationError
constructor
A new instance of InvalidVarianceAnnotationError.
Constructor Details
#initialize(decl:, errors:) ⇒ InvalidVarianceAnnotationError
Returns a new instance of InvalidVarianceAnnotationError.
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
# File 'lib/rbs/errors.rb', line 346 def initialize(decl:, errors:) @decl = decl @errors = errors = [ "#{Location.to_string decl.location}: Invalid variance annotation: #{decl.name}" ] errors.each do |error| case error when MethodTypeError << " MethodTypeError (#{error.param.name}): on `#{error.method_name}` #{error.method_type.to_s} (#{error.method_type.location&.start_line})" when InheritanceError << " InheritanceError: #{error.super_class}" when MixinError << " MixinError: #{error.include_member.name} (#{error.include_member.location&.start_line})" end end super .join("\n") end |
Instance Attribute Details
#decl ⇒ Object (readonly)
Returns the value of attribute decl.
343 344 345 |
# File 'lib/rbs/errors.rb', line 343 def decl @decl end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
344 345 346 |
# File 'lib/rbs/errors.rb', line 344 def errors @errors end |