tuxji commented on code in PR #1180:
URL: https://github.com/apache/daffodil/pull/1180#discussion_r1522066074
##########
daffodil-core/src/main/scala/org/apache/daffodil/core/dpath/Expression.scala:
##########
@@ -975,18 +975,16 @@ sealed abstract class StepExpression(val step: String,
val pred: Option[Predicat
}
final lazy val checkAmbiguousPath: Unit = {
- val (arraysOrOptionals, scalars) = stepElements.partition { se =>
- se.isArray || se.isOptional
- }
- (arraysOrOptionals.length, scalars.length) match {
- case (a, s) if (a > 0 && s > 0) =>
- arraysOrOptionals.head.SDE(
- "Path step is ambiguous. It can reference both an array or a
non-array element, which is not allowed.\n" +
- "One of the non-arrays is %s",
- scalars.head.schemaFileLocation.toString,
- )
- case _ => // do nothing
- }
+ val (arrays, nonArrays) = stepElements.partition { _.isArray }
+ schemaDefinitionWhen(
+ arrays.length > 0 && nonArrays.length > 0,
+ "Path step %s is ambiguous. It can reference both an array or a
non-array element, which is not allowed.\n" +
Review Comment:
I suggest changing `or` to `and` in the error message above, even though it
may cause some tests to require changes to their expected output. When you say
"both", that implies "and" rather than "or".
##########
daffodil-test/src/test/resources/org/apache/daffodil/section23/dfdl_functions/Functions.tdml:
##########
@@ -11693,11 +11693,19 @@
<tdml:document>
<tdml:documentPart type="byte">00 00 00 01</tdml:documentPart>
</tdml:document>
- <tdml:errors>
- <tdml:error>Schema Definition Error</tdml:error>
- <tdml:error>ex:foo</tdml:error>
- <tdml:error>ambiguous</tdml:error>
- </tdml:errors>
+ <tdml:infoset>
Review Comment:
@pkatlic: As @stevedlawrence asked, please check these changes to test
results carefully.
--
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]