lib/steep/errors.rb in steep-0.33.0 vs lib/steep/errors.rb in steep-0.34.0

- old
+ new

@@ -99,24 +99,10 @@ def to_s "#{location_to_str}: ArgumentTypeMismatch: receiver=#{receiver_type}, expected=#{expected}, actual=#{actual}" end end - class IncompatibleBlockParameters < Base - attr_reader :node - attr_reader :method_type - - def initialize(node:, method_type:) - super(node: node) - @method_type = method_type - end - - def to_s - "#{location_to_str}: IncompatibleBlockParameters: method_type=#{method_type}" - end - end - class BlockParameterTypeMismatch < Base attr_reader :expected attr_reader :actual def initialize(node:, expected:, actual:) @@ -184,11 +170,11 @@ super(node: node) @method_type = method_type end def to_s - "#{location_to_str}: RequiredBlockMissing: method_type=#{method_type.location&.source}" + "#{location_to_str}: RequiredBlockMissing: method_type=#{method_type.to_s}" end end class BlockTypeMismatch < Base attr_reader :expected @@ -553,9 +539,27 @@ end def to_s msg = message || "#{node.type} is not supported" "#{location_to_str}: UnsupportedSyntax: #{msg}" + end + end + + class UnexpectedError < Base + attr_reader :message + attr_reader :error + + def initialize(node:, error:) + super(node: node) + @error = error + @message = error.message + end + + def to_s + <<-MESSAGE +#{location_to_str}: UnexpectedError: #{error.class} +>> #{message} + MESSAGE end end end end