class RBS::VarianceCalculator::Result

Result contains the set of type variables and it’s variance in a occurrence.

# Enumerates recorded type variables
result.each do |name, variance|
  # name is the name of a type variable
  # variance is one of :unused | :covariant | :contravariant | :invariant
end

You can test with compatible? method if the type variable occurrences are compatible with specified (annotated) variance.

# When T is declared as `out T`
result.compatible?(:T, with_annotation: :covariant)

# When T is declared as `in T`
result.compatible?(:T, with_annotation: :contravariant)

# When T is declared as `T`
result.compatible?(:T, with_annotation: :invariant)