Sha256: 7547d190da62dce31e086f172baebbf12403698d7190f01bc03ded7d69b5ec8b

Contents?: true

Size: 832 Bytes

Versions: 5

Compression:

Stored size: 832 Bytes

Contents

module Steep
  module AST
    module Types
      class Instance
        attr_reader :location

        def initialize(location: nil)
          @location = location
        end

        def self.instance
          @instance ||= new()
        end

        def ==(other)
          other.is_a?(Instance)
        end

        def hash
          self.class.hash
        end

        alias eql? ==

        def subst(s)
          s.instance_type or raise "Unexpected substitution: #{inspect}"
        end

        def free_variables()
          @fvs = Set.new([self])
        end

        include Helper::NoChild

        def to_s
          "instance"
        end

        def level
          [0]
        end

        def with_location(new_location)
          self.class.new(location: new_location)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
steep-1.3.0.pre.2 lib/steep/ast/types/instance.rb
steep-1.3.0.pre.1 lib/steep/ast/types/instance.rb
steep-1.2.1 lib/steep/ast/types/instance.rb
steep-1.2.0 lib/steep/ast/types/instance.rb
steep-1.2.0.pre.1 lib/steep/ast/types/instance.rb