stevedlawrence commented on a change in pull request #23: This fix done for 
nato-stanag-5516 latest schema.
URL: https://github.com/apache/incubator-daffodil/pull/23#discussion_r159920319
 
 

 ##########
 File path: 
daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/dsom/CompiledExpression1.scala
 ##########
 @@ -377,10 +377,59 @@ class DPathElementCompileInfo(
     retryMatchesERD.length match {
       case 0 => noMatchError(step, possibles)
       case 1 => retryMatchesERD(0)
-      case _ => queryMatchError(step, matchesERD)
+      case _ => {
+        // it's ok if all the names are the same, so long as they are
+        // in separate choices, or otherwise cannot co-exist.
+        //
+        // For now we just check if they are siblings, i.e., have the
+        // same model group as parent.
+        //
+        //        val ambiguousSiblings = 
ambiguousModelGroupSiblings(retryMatchesERD)
+        //        if (ambiguousSiblings.isEmpty)
+        // BUG
+        // This results in multiple siblings with same name, path that is 
ambiguous
+        // just gets first one.
+        //
+        retryMatchesERD(0)
 
 Review comment:
   -1, I'm not sure I like this change as-is. Multiple times I've had to spend 
time tracking down unexpected behavior where the issue was just that there were 
ambiguous paths and Daffodil just always picked the first one. This patch 
essential reverts back to that behavior, which was a pain.
   
   In fact, I think if a query-style expression is used and actually references 
multiple elements, we'll get an invariant failure assertion at parse time in 
``def findChild`` with ``fastSeq.length == 1`` or ``found.length <= 1``.
   
   How about instead we change ``queryMatchError`` to throw an SDW instead of 
an SDE so that users will be made aware that a query-style expression exists, 
which we don't yet support. This will still allow it though, so in ``def 
findChild``, we change the invariant assertions to an SDE, causing a Runtime 
SDE when a query-style expression returns more than one element? This way 1) we 
get an warning when a query style expression exists 2) query style expressions 
can still be used, but only if they ever refer to a single element at runtime 
and 3) we get a Runtime SDE if a query style expression ever returns more than 
one element. So we warn on potential ambiguity, and throw SDE when that 
ambiguity is realized in practice.
     

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to