Class: Steep::Diagnostic::Signature::InconsistentClassModuleAliasError
- Defined in:
- lib/steep/diagnostic/signature.rb
Instance Attribute Summary collapse
-
#decl ⇒ Object
readonly
Returns the value of attribute decl.
Attributes inherited from Base
Instance Method Summary collapse
- #header_line ⇒ Object
-
#initialize(decl:) ⇒ InconsistentClassModuleAliasError
constructor
A new instance of InconsistentClassModuleAliasError.
Methods inherited from Base
#detail_lines, #diagnostic_code, #path
Methods included from Helper
Constructor Details
#initialize(decl:) ⇒ InconsistentClassModuleAliasError
Returns a new instance of InconsistentClassModuleAliasError.
428 429 430 431 |
# File 'lib/steep/diagnostic/signature.rb', line 428 def initialize(decl:) @decl = decl super(location: decl.location&.[](:old_name)) end |
Instance Attribute Details
#decl ⇒ Object (readonly)
Returns the value of attribute decl.
426 427 428 |
# File 'lib/steep/diagnostic/signature.rb', line 426 def decl @decl end |
Instance Method Details
#header_line ⇒ Object
433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
# File 'lib/steep/diagnostic/signature.rb', line 433 def header_line expected_kind = case decl when RBS::AST::Declarations::ModuleAlias "module" when RBS::AST::Declarations::ClassAlias "class" when RBS::AST::Ruby::Declarations::ClassModuleAliasDecl if decl.annotation.is_a?(RBS::AST::Ruby::Annotations::ClassAliasAnnotation) "class" else "module" end end "A #{expected_kind} `#{decl.new_name}` cannot be an alias of `#{decl.old_name}`" end |