Class: TypeProf::Type::ContainerType
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
|
|
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
::TypeProf::Type
|
|
Instance Chain:
|
|
Inherits: |
TypeProf::Type
|
Defined in: | lib/typeprof/container-type.rb |
Overview
Constant Summary
::TypeProf::Type
- Inherited
Class Method Summary
::TypeProf::Type
- Inherited
Instance Method Summary
- #consistent?(other) ⇒ Boolean
- #each_free_type_variable(&blk)
- #include_untyped?(scratch) ⇒ Boolean
- #match?(other) ⇒ Boolean
::TypeProf::Type
- Inherited
Constructor Details
This class inherits a constructor from TypeProf::Type
Class Method Details
.create_empty_instance(klass)
[ GitHub ]# File '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
Instance Method Details
#consistent?(other) ⇒ Boolean
# File 'lib/typeprof/container-type.rb', line 33
def consistent?(other) raise "must not be used" end
#each_free_type_variable(&blk)
[ GitHub ]# File 'lib/typeprof/container-type.rb', line 29
def each_free_type_variable(&blk) @elems.each_free_type_variable(&blk) end
#include_untyped?(scratch) ⇒ Boolean
# File '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) ⇒ Boolean
# File '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