mike-mcgann commented on code in PR #918:
URL: https://github.com/apache/daffodil/pull/918#discussion_r1082882365
##########
daffodil-core/src/main/scala/org/apache/daffodil/grammar/ElementBaseGrammarMixin.scala:
##########
@@ -1368,4 +1371,32 @@ trait ElementBaseGrammarMixin
mtaBase
}
+ val allowedBitTypes = Set[PrimType](
+ PrimType.Boolean,
+ PrimType.Byte,
+ PrimType.Short,
+ PrimType.Int,
+ PrimType.Long,
+ PrimType.UnsignedByte,
+ PrimType.UnsignedShort,
+ PrimType.UnsignedInt,
+ PrimType.UnsignedLong,
+ )
+ val allowedBitTypesText = allowedBitTypes.map("xs:" +
_.toString).toList.sorted.mkString(", ")
+
+ private def assertLengthUnits(elem: ElementBase = context): Unit = {
+ elem.lengthUnits match {
+ case LengthUnits.Bits if elem.representation == Representation.Binary =>
+ elem.optPrimType match {
+ case Some(primType) =>
+ if (!allowedBitTypes.contains(primType))
+ if (tunable.allowBigIntegerBits)
+ SDW(WarnID.DeprecatedBigIntegerBits, s"In a future release,
lengthUnits='bits' will only be supported for the following types:
$allowedBitTypesText")
+ else
+ SDE("lengthUnits='bits' is only supported for the following
types: $allowedBitTypesText")
Review Comment:
Updated to call `elem.{SDE,SDW}`
--
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]