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


##########
daffodil-core/src/main/scala/org/apache/daffodil/core/dpath/Expression.scala:
##########
@@ -969,16 +989,27 @@ sealed abstract class StepExpression(val step: String, 
val pred: Option[Predicat
   }
 
   final lazy val isArray: Boolean = {
-    val (arrays, scalars) = stepElements.partition { _.isArray }
-    (arrays.length, scalars.length) match {
+    checkAmbiguousPath
+    stepElements.exists(_.isArray)
+  }
+
+  final lazy val isOptional: Boolean = {
+    checkAmbiguousPath
+    stepElements.exists(_.isOptional)
+  }

Review Comment:
   I am not sure we should allow this kind of polymorphism. We don't allow 
array and scalar polymorphism, nor optional and scalar polymorphism. I think 
allowing array and optional polymorphism is unwise in this context. 
   
   If you have a path. There should be only one way it needs to be compiled - 
the path steps should be exactly the same on all paths or it should be an 
error. That's certainly the way to avoid what is otherwise a quite subtle 
situation that I would claim, is likely a mistake.  Arrays and optionals have 
different downward steps (DownArrayOccurrence vs. DownElement). 
   



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