@Test
    public void testForEachOverStructCannotConvertType() {
        var tester = new ScriptTester();
        var expression = tester.expressionFrom("input myStructField | for_each { to_array } | attribute myIntArray");
        StructDataType type = new StructDataType("myStruct");
        type.addField(new Field("myInt", DataType.INT));

        SimpleTestAdapter adapter = new SimpleTestAdapter();
        adapter.createField(new Field("myStructField", type));
        adapter.createField(new Field("myIntArray", DataType.getArray(DataType.INT)));
        try {
            expression.resolve(adapter);
            fail();
        } catch (VerificationException e) {
            assertEquals("Invalid expression 'for_each { to_array }': Struct field 'myInt' has type int but expression produces Array<int>",
                         e.getMessage());
        }
    }
@author Simon Thoresen Hult
@author bratseth
indexinglanguage/src/test/java/com/yahoo/vespa/indexinglanguage/ScriptTestCase.java