class TypeProf::Type::ContainerType
Cell
, Array
, and Hash
are types for global interface, e.g., TypedISeq. Do not push such types to local environment, stack, etc.
Public Class Methods
create_empty_instance(klass)
click to toggle source
# File typeprof-0.15.2/lib/typeprof/container-type.rb, line 37 def self.create_empty_instance(klass) base_type = Type::Instance.new(klass) case klass when Type::Builtin[:ary] # XXX: check inheritance... Type::Array.new(Type::Array::Elements.new([], Type.bot), base_type) when Type::Builtin[:hash] Type.gen_hash(base_type) {|h| } else Type::Cell.new(Type::Cell::Elements.new([Type.bot] * klass.type_params.size), base_type) end end
Public Instance Methods
consistent?(other)
click to toggle source
# File typeprof-0.15.2/lib/typeprof/container-type.rb, line 33 def consistent?(other) raise "must not be used" end
each_free_type_variable(&blk)
click to toggle source
# File typeprof-0.15.2/lib/typeprof/container-type.rb, line 29 def each_free_type_variable(&blk) @elems.each_free_type_variable(&blk) end
include_untyped?(scratch)
click to toggle source
# File typeprof-0.15.2/lib/typeprof/container-type.rb, line 49 def include_untyped?(scratch) return true if @base_type.include_untyped?(scratch) return true if @elems.include_untyped?(scratch) false end
match?(other)
click to toggle source
# File typeprof-0.15.2/lib/typeprof/container-type.rb, line 23 def match?(other) return nil if self.class != other.class return nil unless @base_type.consistent?(other.base_type) @elems.match?(other.elems) end