private void resolveTypesIn(RankProfile profile, boolean validate, Set<Reference> warnedAbout) {
        MapEvaluationTypeContext context = profile.typeContext(queryProfiles);
        for (Map.Entry<String, RankProfile.RankingExpressionFunction> function : profile.getFunctions().entrySet()) {
            ExpressionFunction expressionFunction = function.getValue().function();
            if (hasUntypedArguments(expressionFunction)) continue;

            // Add any missing inputs for type resolution
            for (String argument : expressionFunction.arguments()) {
                Reference ref = Reference.fromIdentifier(argument);
                if (context.getType(ref).equals(TensorType.empty)) {
                    context.setType(ref, expressionFunction.getArgumentType(argument));
                }
            }
            context.forgetResolvedTypes();

            TensorType type = resolveType(expressionFunction.getBody(), "function '" + function.getKey() + "'", context);
            function.getValue().setReturnType(type);
        }

        if (validate) {
            profile.getSummaryFeatures().forEach(f -> resolveType(f, "summary feature " + f, context));
            ensureValidDouble(profile.getFirstPhaseRanking(), "first-phase expression", context);
            ensureValidDouble(profile.getSecondPhaseRanking(), "second-phase expression", context);
            ensureValidDouble(profile.getGlobalPhaseRanking(), "global-phase expression", context);
            if ( ( context.tensorsAreUsed() || profile.isStrict())
                 && ! context.queryFeaturesNotDeclared().isEmpty()
                 && ! warnedAbout.containsAll(context.queryFeaturesNotDeclared())) {
                if (profile.isStrict())
                    throw new IllegalArgumentException(profile + " is strict but is missing a " +
                                                       "declaration of inputs " + context.queryFeaturesNotDeclared());
                else
                    deployLogger.logApplicationPackage(Level.WARNING, "The following inputs used in " +
                                                                      profile + " are not declared " +
                                                                      "and will be interpreted as scalars, not tensors: " +
                                                                      context.queryFeaturesNotDeclared());
                warnedAbout.addAll(context.queryFeaturesNotDeclared());
            }
        }
    }
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