Module: Steep::Diagnostic::ResultPrinter2
- Included in:
- Steep::Diagnostic::Ruby::IncompatibleArgumentForwarding, Signature::ModuleSelfTypeError, Signature::UnsatisfiableGenericsDefaultType, Signature::UnsatisfiableTypeApplication
- Defined in:
- lib/steep/diagnostic/result_printer2.rb
Instance Method Summary collapse
Instance Method Details
#detail_lines ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/steep/diagnostic/result_printer2.rb', line 32 def detail_lines lines = StringIO.new.tap do |io| failure_path = result.failure_path || [] failure_path.reverse_each.filter_map do |result| result_line(result) end.each.with_index(1) do |, index| io.puts "#{" " * (index)}#{}" end end.string.chomp unless lines.empty? lines end end |
#result_line(result) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/steep/diagnostic/result_printer2.rb', line 4 def result_line(result) case result when Subtyping::Result::Failure case result.error when Subtyping::Result::Failure::UnknownPairError nil when Subtyping::Result::Failure::UnsatisfiedConstraints "Unsatisfied constraints: #{result.relation}" when Subtyping::Result::Failure::MethodMissingError "Method `#{result.error.name}` is missing" when Subtyping::Result::Failure::BlockMismatchError "Incomaptible block: #{result.relation}" when Subtyping::Result::Failure::ParameterMismatchError if result.relation.params? "Incompatible arity: #{result.relation.super_type} and #{result.relation.sub_type}" else "Incompatible arity: #{result.relation}" end when Subtyping::Result::Failure::PolyMethodSubtyping "Unsupported polymorphic method comparison: #{result.relation}" when Subtyping::Result::Failure::SelfBindingMismatch "Incompatible block self type: #{result.relation}" end else result.relation.to_s end end |