Sha256: c1cc7fcc1a55415d76b51ff916cbcb2fb8ccc50e532076fc3febead3fd1dfe97

Contents?: true

Size: 595 Bytes

Versions: 3

Compression:

Stored size: 595 Bytes

Contents

module Steep
  module AST
    module Types
      class Self
        attr_reader :location

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

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

        def hash
          self.class.hash
        end

        alias eql? ==

        def to_s
          "self"
        end

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

        def free_variables
          Set.new
        end

        def level
          [0]
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
steep-0.3.0 lib/steep/ast/types/self.rb
steep-0.2.0 lib/steep/ast/types/self.rb
steep-0.1.0 lib/steep/ast/types/self.rb