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.
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/rbs/errors.rb', line 165 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.
162 163 164 |
# File 'lib/rbs/errors.rb', line 162 def decl @decl end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
163 164 165 |
# File 'lib/rbs/errors.rb', line 163 def errors @errors end |