Sha256: 735dac16c80ae71846f3f58214acd20f04ddeb8e39d8a9a25e71b8ef94869b5c

Contents?: true

Size: 1.11 KB

Versions: 11

Compression:

Stored size: 1.11 KB

Contents

module Steep
  module Signature
    module Errors
      class Base
        attr_reader :location

        def loc_to_s
          RBS::Location.to_string location
        end

        def to_s
          StringIO.new.tap do |io|
            puts io
          end.string
        end

        def path
          location.buffer.name
        end
      end

      class UnknownTypeNameError < Base
        attr_reader :name

        def initialize(name:, location:)
          @name = name
          @location = location
        end

        def puts(io)
          io.puts "#{loc_to_s}\tUnknownTypeNameError: name=#{name}"
        end
      end

      class InvalidTypeApplicationError < Base
        attr_reader :name
        attr_reader :args
        attr_reader :params

        def initialize(name:, args:, params:, location:)
          @name = name
          @args = args
          @params = params
          @location = location
        end

        def puts(io)
          io.puts "#{loc_to_s}\tInvalidTypeApplicationError: name=#{name}, expected=[#{params.join(", ")}], actual=[#{args.join(", ")}]"
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
steep-0.21.0 lib/steep/signature/errors.rb
steep-0.20.0 lib/steep/signature/errors.rb
steep-0.19.0 lib/steep/signature/errors.rb
steep-0.18.0 lib/steep/signature/errors.rb
steep-0.17.1 lib/steep/signature/errors.rb
steep-0.17.0 lib/steep/signature/errors.rb
steep-0.16.3 lib/steep/signature/errors.rb
steep-0.16.2 lib/steep/signature/errors.rb
steep-0.16.1 lib/steep/signature/errors.rb
steep-0.16.0 lib/steep/signature/errors.rb
steep-0.15.0 lib/steep/signature/errors.rb