class TypedRb::Types::TyExistentialType
Attributes
local_typing_context[RW]
self_variable[RW]
Public Class Methods
new(ruby_type, node = nil)
click to toggle source
Calls superclass method
# File lib/typed/types/ty_existential_type.rb, line 8 def initialize(ruby_type, node = nil) super(ruby_type, node) @hierarchy = [ruby_type] + Module.ancestors @classes = @hierarchy.select { |klass| klass.instance_of?(Class) } @modules = @hierarchy.select { |klass| klass.instance_of?(Module) } end
Public Instance Methods
check_inclusion(self_type)
click to toggle source
# File lib/typed/types/ty_existential_type.rb, line 15 def check_inclusion(self_type) cloned_context, _ = local_typing_context.clone(:module_self) Types::TypingContext.with_context(cloned_context) do context_self_type = Types::TypingContext.type_variable_for(ruby_type, :module_self, [ruby_type]) context_self_type.compatible?(self_type, :lt) Types::Polymorphism::Unification.new(Types::TypingContext.all_constraints).run(false) end end