class TypeProf::Core::AST::SigFuncType::SigTyAliasNode::SigTyUnionNode::SigTySingletonNode::SigTyInstanceNode::SigTyTupleNode - typeprof: Ruby Standard Library Documentation

# class TypeProf::Core::AST::SigFuncType::SigTyAliasNode::SigTyUnionNode::SigTySingletonNode::SigTyInstanceNode::SigTyTupleNode

### Attributes

types[R]

### Public Class Methods

new(raw_decl, lenv) click to toggle source
Calls superclass method `TypeProf::Core::AST::Node::new`

    # File typeprof-0.30.1/lib/typeprof/core/ast/sig_type.rb, line 452
    def initialize(raw_decl, lenv)
      super(raw_decl, lenv)
      @types = raw_decl.types.map {|type| AST.create_rbs_type(type, lenv) }
    end

### Public Instance Methods

contravariant_vertex0(genv, changes, vtx, subst) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/sig_type.rb, line 470
    def contravariant_vertex0(genv, changes, vtx, subst)
      unified_elem = changes.new_contravariant_vertex(genv, [self, :Elem]) # TODO
      elems = @types.map do |type|
        nvtx = type.contravariant_vertex(genv, changes, subst)
        changes.add_edge(genv, nvtx, unified_elem)
        nvtx
      end
      changes.add_edge(genv, Source.new(Type::Array.new(genv, elems, genv.gen_ary_type(unified_elem))), vtx)
    end

covariant_vertex0(genv, changes, vtx, subst) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/sig_type.rb, line 460
    def covariant_vertex0(genv, changes, vtx, subst)
      unified_elem = changes.new_covariant_vertex(genv, [self, :Elem]) # TODO
      elems = @types.map do |type|
        nvtx = type.covariant_vertex(genv, changes, subst)
        changes.add_edge(genv, nvtx, unified_elem)
        nvtx
      end
      changes.add_edge(genv, Source.new(Type::Array.new(genv, elems, genv.gen_ary_type(unified_elem))), vtx)
    end

show() click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/sig_type.rb, line 480
    def show
      "[#{ @types.map {|ty| ty.show }.join(", ") }]"
    end

subnodes(= { types: }) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/sig_type.rb, line 458
      def subnodes = { types: }

      def covariant_vertex0(genv, changes, vtx, subst)
        unified_elem = changes.new_covariant_vertex(genv, [self, :Elem]) # TODO
        elems = @types.map do |type|
          nvtx = type.covariant_vertex(genv, changes, subst)
          changes.add_edge(genv, nvtx, unified_elem)
          nvtx
        end
        changes.add_edge(genv, Source.new(Type::Array.new(genv, elems, genv.gen_ary_type(unified_elem))), vtx)
      end

      def contravariant_vertex0(genv, changes, vtx, subst)
        unified_elem = changes.new_contravariant_vertex(genv, [self, :Elem]) # TODO
        elems = @types.map do |type|
          nvtx = type.contravariant_vertex(genv, changes, subst)
          changes.add_edge(genv, nvtx, unified_elem)
          nvtx
        end
        changes.add_edge(genv, Source.new(Type::Array.new(genv, elems, genv.gen_ary_type(unified_elem))), vtx)
      end

      def show
        "[#{ @types.map {|ty| ty.show }.join(", ") }]"
      end
    end