/// <summary> /// Precondition: GuardTypeArguments must have been called. /// We can't call it from here, because we don't know where this type has /// been used, which is where the error must be thrown, /// </summary> public ConcreteClassType(GenericClassType genericType, Type[] typeArguments) : base(genericType.Scope, genericType.Access, genericType.Name, genericType.DefiningToken, genericType.GenericTypeParameters) { GenericType = genericType; TypeArguments = typeArguments; Name = $"{ GenericName }<{ string.Join(", ", typeArguments.Select(t => t.Name)) }>"; declareMembers(); }
public static void GuardTypeArguments(Token token, GenericClassType genericType, Types.Type[] typeArguments) { var error = new Exceptions.InvalidTypeArgumentListException(token, genericType, typeArguments); if (genericType.GenericTypeParameters.Length != typeArguments.Length) { throw error; } // for (int i = 0; i < genericType.GenericTypeParameters.Length; i++) { // var param = genericType.GenericTypeParameters[i]; // var arg = typeArguments[i]; // // Future: Check type compatibilities // } }