static ParameterizedType CreateUnderlyingType(ICompilation compilation, ImmutableArray <IType> elementTypes, IModule valueTupleAssembly) { int remainder = (elementTypes.Length - 1) % (RestPosition - 1) + 1; Debug.Assert(remainder >= 1 && remainder < RestPosition); int pos = elementTypes.Length - remainder; var type = new ParameterizedType( FindValueTupleType(compilation, valueTupleAssembly, remainder), elementTypes.Slice(pos)); while (pos > 0) { pos -= (RestPosition - 1); type = new ParameterizedType( FindValueTupleType(compilation, valueTupleAssembly, RestPosition), elementTypes.Slice(pos, RestPosition - 1).Concat(new[] { type })); } Debug.Assert(pos == 0); return(type); }
public bool Equals(IType other) { if (this == other) { return(true); } ParameterizedType c = other as ParameterizedType; if (c == null || !genericType.Equals(c.genericType) || typeArguments.Length != c.typeArguments.Length) { return(false); } for (int i = 0; i < typeArguments.Length; i++) { if (!typeArguments[i].Equals(c.typeArguments[i])) { return(false); } } return(true); }
public virtual IType VisitParameterizedType(ParameterizedType type) { return(type.VisitChildren(this)); }