class TypedRb::Types::UncomparableTypes

Attributes

from[R]
to[R]

Public Class Methods

new(from, to, node = nil, msg='') click to toggle source
Calls superclass method TypedRb::TypeCheckError::new
# File lib/typed/types/ty_object.rb, line 5
def initialize(from, to, node = nil, msg='')
  nodes = [from.node, to.node].compact
  if node
    super("Cannot compare types #{from} <=> #{to}#{msg}", node)
  elsif nodes.size == 2
    super("Cannot compare types #{from} <=> #{to}#{msg}", nodes)
  elsif nodes.size == 1
    super("Cannot compare types #{from} <=> #{to}#{msg}", nodes.first)
  else
    super("Cannot compare types #{from} <=> #{to}#{msg}", nil)
  end
end