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


##########
daffodil-core/src/main/scala/org/apache/daffodil/core/dpath/Expression.scala:
##########
@@ -2329,6 +2342,11 @@ abstract class FunctionCallBase(
   protected def checkArgArrayOrOptional(): Unit = {
     lazy val isArrayOrOptional = expressions.head match {
       case pe: PathExpression => pe.isPathToOneWholeArrayOrOptional
+      case ie: IfExpression => {
+        val tp = ie.thenPart
+        val ep = ie.elsePart
+        tp.isPathToOneWholeArrayOrOptional || 
ep.isPathToOneWholeArrayOrOptional

Review Comment:
   Looking at this code, I'm confused why tests count_17 and count_18 work 
correctly.  I saw the `||` and it looks to me like we want to replace `||` with 
`&&` since we want both parts (thenPart & elsePart) to be paths to arrays or 
optional elements, not just one of them.  However, these tests seem to show 
this logic works correctly (e.g., fail if thenPart and elsePart have different 
values for `isPathToOneWholeArrayOrOptional`, pass otherwise).  Maybe Daffodil 
has type checking elsewhere which fails the test before this logic has a chance 
to run?  Please set a breakpoint here and debug the test count_18 to see 
whether this logic is actually executed.



-- 
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