stevedlawrence opened a new pull request, #1578:
URL: https://github.com/apache/daffodil/pull/1578

   Commit 6650eb918e modified if-expressions to use typeLeastUpperBound instead 
of generalizeArgAndResultTypesForNumericOp to calculate the result type of the 
if-expression. The thinking was that if-expressions aren't really numeric 
operations and so shouldn't use the same logic.
   
   However, typeLeastUpperBound can return non-primitive types which can lead 
to issues. For example, if one branch of an if-expression returns xs:double and 
the other returns xs:int, then the least upper bound is SignedNumeric, which is 
not a primitive type and can lead to failures in cases where DPath operations 
require an actual type.
   
   We fix this by reverting back to using 
generalizeArgAndResultTypesForNumericOp. Although this function is intended for 
numeric operations, the same logic of promoting different numeric types to a 
single primitive type is needed for if-expressions. And it is not too far 
fetched to say that if the branches of an if-expression are numeric, then the 
if-expression is essentially a numeric operation.
   
   DAFFODIL-2574


-- 
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]

Reply via email to