private DataType verifyStructFields(StructDataType struct, TypeContext context) {
        for (Field field : struct.getFields()) {
            DataType fieldType = field.getDataType();
            DataType fieldOutputType = expression.setInputType(fieldType, context);
            if (fieldOutputType != null && ! fieldOutputType.isAssignableTo(fieldType))
                throw new VerificationException(this, "Struct field '" + field.getName() + "' has type " + fieldType.getName() +
                                                      " but expression produces " + fieldOutputType.getName());
            DataType fieldInputType = expression.setOutputType(fieldType, context);
            if (fieldOutputType != null && ! fieldType.isAssignableTo(fieldInputType))
                throw new VerificationException(this, "Struct field '" + field.getName() + "' has type " + fieldType.getName() +
                                                      " but expression requires " + fieldInputType.getName());
            if (fieldOutputType == null && fieldInputType == null)
                return null; // Neither direction could be inferred
        }
        return struct;
    }
Verifies that each struct field is compatible with the expression.
This is symmetric in both verification directions since the expression just need to be compatible with
all the struct fields.
indexinglanguage/src/main/java/com/yahoo/vespa/indexinglanguage/expressions/ForEachExpression.java