pkatlic commented on code in PR #1137:
URL: https://github.com/apache/daffodil/pull/1137#discussion_r1470188930


##########
daffodil-test/src/test/resources/org/apache/daffodil/section23/dfdl_functions/Functions.tdml:
##########
@@ -5212,6 +5212,80 @@
       </xs:complexType>
     </xs:element>
 
+    <xs:group name="countGroup">
+      <xs:sequence>
+        <xs:element name="count" type="xs:int" dfdl:representation="binary" 
dfdl:inputValueCalc="{ fn:count(../ex:foo) }"/>
+      </xs:sequence>
+    </xs:group>
+    <xs:element name="scalarOptional">
+      <xs:complexType>
+        <xs:sequence>
+          <xs:element name="scalar">
+            <xs:complexType>
+              <xs:sequence>
+                <xs:element name="foo" type="xs:int" 
dfdl:representation="binary"/>
+                <xs:group ref="countGroup"/>
+              </xs:sequence>
+            </xs:complexType>
+          </xs:element>
+          <xs:element name="optional">
+            <xs:complexType>
+              <xs:sequence>
+                <xs:element name="foo" type="xs:int" minOccurs="0" 
dfdl:representation="binary"/>
+                <xs:group ref="countGroup"/>
+              </xs:sequence>
+            </xs:complexType>
+          </xs:element>
+        </xs:sequence>
+      </xs:complexType>
+    </xs:element>
+    <xs:element name="scalarArray">
+      <xs:complexType>
+        <xs:sequence>
+          <xs:element name="scalar">
+            <xs:complexType>
+              <xs:sequence>
+                <xs:element name="foo" type="xs:int" 
dfdl:representation="binary"/>
+                <xs:group ref="countGroup"/>
+              </xs:sequence>
+            </xs:complexType>
+          </xs:element>
+          <xs:element name="array">
+            <xs:complexType>
+              <xs:sequence>
+                <xs:element name="foo" type="xs:int" minOccurs="2" 
maxOccurs="2" dfdl:representation="binary"/>
+                <xs:group ref="countGroup"/>
+              </xs:sequence>
+            </xs:complexType>
+          </xs:element>
+        </xs:sequence>
+      </xs:complexType>
+    </xs:element>
+    <xs:element name="arrayOptional">
+      <xs:complexType>
+        <xs:sequence>
+          <xs:element name="array">
+            <xs:complexType>
+              <xs:sequence>
+                <xs:element name="foo" type="xs:int" minOccurs="2" 
maxOccurs="2" dfdl:representation="binary"/>
+                <xs:group ref="countGroup"/>
+              </xs:sequence>
+            </xs:complexType>
+          </xs:element>
+          <xs:element name="optional">
+            <xs:complexType>
+              <xs:sequence>
+                <xs:element name="foo" type="xs:int" minOccurs="0" 
maxOccurs="1" dfdl:representation="binary"/>
+                <xs:element name="count" type="xs:int" 
dfdl:representation="binary" dfdl:inputValueCalc="{ fn:count(../ex:foo) }"/>
+                <!-- throws ClassCastException -->

Review Comment:
   When referencing a group here a ClassCastException is thrown, which may be a 
bug.
   
   class org.apache.daffodil.runtime1.infoset.DISimple cannot be cast to class 
org.apache.daffodil.runtime1.infoset.DIArray



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to