public override Classifier CommonSuperType(Classifier other) { TupleType otherTuple = other as TupleType; if (otherTuple != null) { List <Property> tupleParts = new List <Property>(); foreach (var otherVar in otherTuple) { Property thisVar; if (TupleParts.TryGetValue(otherVar.Name, out thisVar) == false) { continue; } tupleParts.Add(new Property(thisVar.Name, (PropertyType)Math.Max((int)thisVar.PropertyType, (int)otherVar.PropertyType), thisVar.Type.CommonSuperType(otherVar.Type))); } TupleType newTuple = new TupleType(TypeTable, tupleParts); TypeTable.RegisterType(newTuple); return(newTuple); } if (other is IConformsToComposite && other is ICompositeType == false) { return(other.CommonSuperType(this));// commonSuperType is symetric } return(base.CommonSuperType(other)); }
public override Classifier CommonSuperType(Classifier other) { Classifier common = CommonSuperType <CollectionType>((tt, el) => tt.Library.CreateCollection(CollectionKind.Collection, el), other); if (common == null) { if (other is IConformsToComposite && other is ICompositeType == false) { return(other.CommonSuperType(this));// commonSuperType is symetric } return(base.CommonSuperType(other)); } return(common); }