Brandon Sloane created DAFFODIL-2065:
----------------------------------------

             Summary: Incorrectly attempting to cast signed to unsigned type
                 Key: DAFFODIL-2065
                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2065
             Project: Daffodil
          Issue Type: Bug
          Components: Back End
    Affects Versions: 2.2.0
         Environment: Ubuntu 18.04.1 LTS
            Reporter: Brandon Sloane
         Attachments: test.dfdl.xsd

When adding a signed and unsigned type, Daffodil attempts to cast the signed 
value to unsigned. The correct behaviour would be to cast the unsigned to 
signed.

When running the attached schema on an empty file, the following error is 
produced:
{quote}[error] Schema Definition Error: Cannot convert '-1' from Long type to 
UnsignedInt (Negative value -1 cannot be converted to an unsigned int.).
Schema context: element reference tns:x Location line 3 in 
file:/home/bsloane/Documents/incubator-daffodil/test/test.dfdl.xsd

The relevent piece of schema is:

<xs:element name="x" type="xs:int" dfdl:inputValueCalc="\{ xs:unsignedInt(1) + 
(-1) }" />
{quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to