class T::Types::TypeVariable

Since we do type erasure at runtime, this just validates the variance and provides some syntax for the static type checker

Constants

VALID_VARIANCES

Attributes

variance[R]

Public Class Methods

new(variance) click to toggle source
# File lib/types/types/type_variable.rb, line 12
def initialize(variance)
  if !VALID_VARIANCES.include?(variance)
    raise TypeError.new("invalid variance #{variance}")
  end
  @variance = variance
end

Public Instance Methods

name() click to toggle source
# File lib/types/types/type_variable.rb, line 27
def name
  Untyped.new.name
end
subtype_of_single?(type) click to toggle source
# File lib/types/types/type_variable.rb, line 23
def subtype_of_single?(type)
  true
end
valid?(obj) click to toggle source
# File lib/types/types/type_variable.rb, line 19
def valid?(obj)
  true
end