mbeckerle commented on a change in pull request #207: Added support for
enumerations and TypeValueCalc
URL: https://github.com/apache/incubator-daffodil/pull/207#discussion_r275128903
##########
File path:
daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/ChoiceCombinator.scala
##########
@@ -70,12 +119,51 @@ case class ChoiceCombinator(ch: ChoiceTermBase,
rawAlternatives: Seq[Gram])
"dfdl:choiceBranchKey value (%s) is not unique across all
branches of a direct dispatch choice. Offending branches are:\n%s",
k, kvs.map(_._2.context.runtimeData).map(rd =>
rd.diagnosticDebugName + " " +
rd.schemaFileLocation.locationDescription).mkString("- ", "\n- ", ""))
}
+ Try(k.toLong) match {
+ case Success(v) => {
+ val asBigInt = BigInt(v)
+ val conflictingRanges = dispatchBranchKeyRangeTuples.filter({
case (min, max, _, _) => min.testAsLower(asBigInt) && max.testAsUpper(asBigInt)
})
+ if (conflictingRanges.length > 0) {
+ SDE(
+ "dfdl:choiceBranchKey (%s) conflicts with
dfdl:choiceBranchKeyRanges. Offending branches are:\n%s\n%s",
+ k,
+ kvs.map(_._2.context.runtimeData).map(rd =>
rd.diagnosticDebugName + " " +
rd.schemaFileLocation.locationDescription).mkString("- ", "\n- ", ""),
+ conflictingRanges.map(_._3.context).map(rd =>
rd.diagnosticDebugName + " " +
rd.schemaFileLocation.locationDescription).mkString("- ", "\n- ", ""))
+ }
+ }
+ case Failure(_) => ()
Review comment:
So if k.toLong fails, you don't throw the error/capture it as an SDE? Why is
it ok to suppress this here?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services