Inference/src/TypeSystem/UnionType.cs
/// <summary>
/// This method creates a new type variable.
/// It these type variables where bounded to types or other
/// type variables, they are maintained.
/// </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>
/// <returns>The new cloned class type</returns>
This method creates a new type variable.
It these type variables where bounded to types or other
type variables, they are maintained.
This method creates a new type variable . It these type variables where bounded to types or other type variables they are maintained .
public override TypeExpression CloneType(IDictionary<TypeVariable, TypeVariable> typeVariableMappings)
        {
            if (!this.HasTypeVariables())
                return this;
            UnionType newUnionType = (UnionType)this.MemberwiseClone();
            newUnionType.typeSet = new List<TypeExpression>();
            List<TypeExpression> currentTypeSet = new List<TypeExpression>();
            currentTypeSet.AddRange(this.typeSet);
            foreach (TypeExpression type in currentTypeSet)
                newUnionType.typeSet.Add(type.CloneType(typeVariableMappings));
            return newUnionType;
        }
public override TypeExpression CloneType ( IDictionary < TypeVariable , TypeVariable > typeVariableMappings ) { if ( ! this . HasTypeVariables ( ) ) return this ; UnionType newUnionType = ( UnionType ) this . MemberwiseClone ( ) ; newUnionType . typeSet = new List < TypeExpression > ( ) ; List < TypeExpression > currentTypeSet = new List < TypeExpression > ( ) ; currentTypeSet . AddRange ( this . typeSet ) ; foreach ( TypeExpression type in currentTypeSet ) newUnionType . typeSet . Add ( type . CloneType ( typeVariableMappings ) ) ; return newUnionType ; }
This method creates a new type variable.
This method creates a new type variable .
// * Clones all the types in the union
The new cloned class type
The new cloned class type
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 .