VarianceMap

dotty.tools.dotc.core.Types.VarianceMap
opaque object VarianceMap

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Types

opaque type VarianceMap[K <: AnyRef]

An immutable map representing the variance of keys of type K

An immutable map representing the variance of keys of type K

Attributes

Value members

Concrete methods

def empty[K <: AnyRef]: VarianceMap[K]

Extensions

Extensions

extension [K <: AnyRef](vmap: VarianceMap[K])
def computedVariance(k: K): Integer | Null

Return the variance of k:

Return the variance of k:

  • A positive value means that k appears only covariantly.
  • A negative value means that k appears only contravariantly.
  • A zero value means that k appears both covariantly and contravariantly, or appears invariantly.
  • A null value means that k does not appear at all.

Attributes

def recordLocalVariance(k: K, localVariance: Int): VarianceMap[K]

Return a new map taking into account that K appears in a {co,contra,in}-variant position if localVariance is {positive,negative,zero}.

Return a new map taking into account that K appears in a {co,contra,in}-variant position if localVariance is {positive,negative,zero}.

Attributes

The backing map used to implement this VarianceMap.

The backing map used to implement this VarianceMap.

Attributes