Class: Steep::Diagnostic::Ruby::UnreachableValueBranch

Inherits:
Base
  • Object
show all
Defined in:
lib/steep/diagnostic/ruby.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#location, #node

Instance Method Summary collapse

Methods inherited from Base

#detail_lines, #diagnostic_code

Methods included from Helper

#error_name, #full_message

Constructor Details

#initialize(node:, type:, location: node.location.expression) ⇒ UnreachableValueBranch

Returns a new instance of UnreachableValueBranch.



720
721
722
723
# File 'lib/steep/diagnostic/ruby.rb', line 720

def initialize(node:, type:, location: node.location.expression)
  super(node: node, location: location)
  @type = type
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



718
719
720
# File 'lib/steep/diagnostic/ruby.rb', line 718

def type
  @type
end

Instance Method Details

#header_lineObject



725
726
727
# File 'lib/steep/diagnostic/ruby.rb', line 725

def header_line
  "The branch may evaluate to a value of `#{type}` but unreachable"
end