Module: Steep::Diagnostic::Ruby::ResultPrinter
- Included in:
- ArgumentTypeMismatch, BlockBodyTypeMismatch, BlockTypeMismatch, BreakTypeMismatch, ImplicitBreakValueMismatch, IncompatibleAnnotation, IncompatibleAssignment, MethodBodyTypeMismatch, MethodReturnTypeAnnotationMismatch, ReturnTypeMismatch, SetterBodyTypeMismatch, SetterReturnTypeMismatch, TypeArgumentMismatchError, UnsatisfiableConstraint
- Defined in:
- lib/steep/diagnostic/ruby.rb
Instance Method Summary collapse
Instance Method Details
#detail_lines ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/steep/diagnostic/ruby.rb', line 48 def detail_lines lines = StringIO.new.tap do |io| failure_path = result.failure_path || [] failure_path.reverse_each.map do |result| (result.relation) end.compact.each.with_index(1) do |, index| io.puts "#{" " * (index)}#{}" end end.string.chomp unless lines.empty? lines end end |
#relation_message(relation) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/steep/diagnostic/ruby.rb', line 29 def (relation) case when relation.type? relation.to_s when relation.method? if relation.super_type.is_a?(Interface::MethodType) && relation.sub_type.is_a?(Interface::MethodType) relation.to_s end when relation.interface? nil when relation.block? "(Blocks are incompatible)" when relation.function? nil when relation.params? "(Params are incompatible)" end end |