Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DFDL-1669

DPath expression { x eq 3 } fails when x is unsignedLong

XMLWordPrintableJSON

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 2.0.0
    • 2.0.0
    • Middle "End"
    • None

      If x is an element of type unsignedLong, then the expression x eq 3 compiles so that x's value, which is an unsignedLong, comes out of the infoset as a java.lang.Long but the constant 3 is a java.math.BigInteger, so comparison, which boils down to scala "==" operation, returns false.

      The mistake, I think, is that this value, coming from element x, should a java.math.BigInteger becasue it is of type unsignedLong. It seems incorrect that the value is a java.lang.Long since that's not capable of representing the unsigned values that have the most-significant-bit on (unless its value is interpreted as a ULong).

      In general, the way types are converged for the two arguments of an operation must be different depending on whether the operation is comparison or arithmetic. If comparison they must be converged to a type which can be compared properly.

      The method numericBinaryOpTargetTypes doesn't consider whether the operation is a comparison or arithmetic.

              mbeckerle.dfdl Mike Beckerle
              mbeckerle.dfdl Mike Beckerle
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: