Inference/src/TypeSystem/UnionType.cs
/// <summary>
/// Method that clones each type variable of a type expression.
/// Equivalence classes are not cloned (but included in the equivalenceClasses parameter.
/// The default implementation is do nothing (for built-in types).
/// </summary>
/// <param name="typeVariableMappings">Each new type varaiable represent a copy of another existing one.
/// This parameter is a mapping between them, wher tmpName=old and value=new</param>
/// <param name="equivalenceClasses">Each equivalence class of all the type variables.</param>
/// <param name="clonedClasses">This parameter collects the set of all cloned classes. It is used to detect infinite recursion.</param>
/// <returns>The new type expression (itself by default)</returns>
Method that clones each type variable of a type expression.
Equivalence classes are not cloned (but included in the equivalenceClasses parameter.
The default implementation is do nothing (for built-in types).
Method that clones each type variable of a type expression . Equivalence classes are not cloned ( but included in the equivalenceClasses parameter . The default implementation is do nothing ( for built - in types ) .
public override TypeExpression CloneTypeVariables(IDictionary<TypeVariable, TypeVariable> typeVariableMappings, IList<EquivalenceClass> equivalenceClasses, IList<ClassType> clonedClasses) {
            if (!this.HasTypeVariables())
                return this;
            UnionType newType = (UnionType)this.MemberwiseClone();
            IList<TypeExpression> oldTypeSet = this.typeSet;
            newType.typeSet = new List<TypeExpression>();
            foreach (TypeExpression oldType in oldTypeSet)
                newType.typeSet.Add(oldType.CloneTypeVariables(typeVariableMappings, equivalenceClasses, clonedClasses));
            newType.ValidTypeExpression = false;
            return newType;
        }
public override TypeExpression CloneTypeVariables ( IDictionary < TypeVariable , TypeVariable > typeVariableMappings , IList < EquivalenceClass > equivalenceClasses , IList < ClassType > clonedClasses ) { if ( ! this . HasTypeVariables ( ) ) return this ; UnionType newType = ( UnionType ) this . MemberwiseClone ( ) ; IList < TypeExpression > oldTypeSet = this . typeSet ; newType . typeSet = new List < TypeExpression > ( ) ; foreach ( TypeExpression oldType in oldTypeSet ) newType . typeSet . Add ( oldType . CloneTypeVariables ( typeVariableMappings , equivalenceClasses , clonedClasses ) ) ; newType . ValidTypeExpression = false ; return newType ; }
Method that clones each type variable of a type expression.
Method that clones each type variable of a type expression .
The new type expression (itself by default)
The new type expression ( itself by default )
typeVariableMappings
IDictionary<TypeVariable, TypeVariable>
Each new type varaiable represent a copy of another existing one.
This parameter is a mapping between them, wher tmpName=old and value=new
Each new type varaiable represent a copy of another existing one . This parameter is a mapping between them wher tmpName = old and value = new
equivalenceClasses
IList<EquivalenceClass>
Each equivalence class of all the type variables.
Each equivalence class of all the type variables .
clonedClasses
IList<ClassType>
This parameter collects the set of all cloned classes. It is used to detect infinite recursion.
This parameter collects the set of all cloned classes . It is used to detect infinite recursion .