private TensorType resolveType(ExpressionNode expression, String expressionDescription, TypeContext<Reference> context) {
        TensorType type;
        try {
            type = expression.type(context);
        }
        catch (IllegalArgumentException e) {
            throw new IllegalArgumentException("The " + expressionDescription + " is invalid", e);
        }
        if (type == null) // Not expected to happen
            throw new IllegalStateException("Could not determine the type produced by " + expressionDescription);
        return type;
    }
Resolves the types of all functions in the given profile

@throws IllegalArgumentException if validate is true and the given rank profile does not produce valid types
config-model/src/main/java/com/yahoo/schema/processing/RankingExpressionTypeResolver.java