mbeckerle commented on a change in pull request #259: Incremental progress on 
schema compilation space/speed issue.
URL: https://github.com/apache/incubator-daffodil/pull/259#discussion_r303192501
 
 

 ##########
 File path: 
daffodil-core/src/main/scala/org/apache/daffodil/dpath/NodeInfoUtils.scala
 ##########
 @@ -100,57 +99,82 @@ object NodeInfoUtils {
       case Long => Long
       case Float => Int
       case Int => Int
+      case Short => Short
       case ArrayIndex => ArrayIndex
       case _ => Assert.usageError("Unsupported return type: 
%s".format(resultType))
     }
 
-    val (argType: Numeric.Kind, resultType: Numeric.Kind) = (leftArgType, 
rightArgType) match {
-      case (_, Decimal) => (Decimal, Decimal)
-      case (Decimal, _) => (Decimal, Decimal)
-      case (_, Double) => (Double, Double)
-      case (Double, _) => (Double, Double)
-      case (_, Float) => (Float, Float)
-      case (Float, _) => (Float, Float)
-      case (_, Integer) => (Integer, Integer)
-      case (Integer, _) => (Integer, Integer)
-      case (_: SignedInteger.Kind, NonNegativeInteger) => (Integer, Integer)
-      case (_, NonNegativeInteger) => (NonNegativeInteger, Integer)
-      case (NonNegativeInteger, _: SignedInteger.Kind) => (Integer, Integer)
-      case (NonNegativeInteger, _) => (NonNegativeInteger, Integer)
-      case (_: SignedInteger.Kind, UnsignedLong) => (Integer, Integer)
-      case (_, UnsignedLong) => (UnsignedLong, Integer)
-      case (UnsignedLong, _: SignedInteger.Kind) => (Integer, Integer)
-      case (UnsignedLong, _) => (UnsignedLong, Integer)
-      case (_, ArrayIndex) => (ArrayIndex, ArrayIndex)
-      case (ArrayIndex, _) => (ArrayIndex, ArrayIndex)
-      case (_, Long) => (Long, Long)
-      case (Long, _) => (Long, Long)
-      case (_: SignedInteger.Kind, UnsignedInt) => (Long, Long)
-      case (_, UnsignedInt) => (UnsignedInt, Long)
-      case (UnsignedInt, _: SignedInteger.Kind) => (Long, Long)
-      case (UnsignedInt, _) => (UnsignedInt, Long)
-      case (_, Int) => (Int, Int)
-      case (Int, _) => (Int, Int)
-      case (_: SignedInteger.Kind, UnsignedShort) => (Int, Int)
-      case (_, UnsignedShort) => (UnsignedShort, Int)
-      case (UnsignedShort, _: SignedInteger.Kind) => (Int, Int)
-      case (UnsignedShort, _) => (UnsignedShort, Int)
-      case (_, Short) => (Short, Int)
-      case (Short, _) => (Short, Int)
-      case (_: SignedInteger.Kind, UnsignedByte) => (Short, Short)
-      case (_, UnsignedByte) => (UnsignedByte, Short)
-      case (UnsignedByte, _: SignedInteger.Kind) => (Short, Short)
-      case (UnsignedByte, _) => (UnsignedByte, Short)
-      case (_, Byte) => (Byte, Int)
-      case (Byte, _) => (Byte, Int)
-      case _ => Assert.usageError(
-        "Unsupported types for numeric op '%s' were %s and %s.".format(op, 
leftArgType, rightArgType))
+    val (argType: Numeric.Kind, resultType: Numeric.Kind) = {
+      val lub = NodeInfoUtils.typeLeastUpperBound(leftArgType, rightArgType)
+      //
+      // For each abstract type that could be the least upper bound of the two
+      // arg types, we must pick a concrete type to convert everything into.
+      val lubImplementationType = lub match {
+        case SignedNumeric => NodeInfo.Double
+        case _ => lub
+      }
+      (lubImplementationType, lubImplementationType)
     }
+
+    //      (leftArgType, rightArgType) match {
 
 Review comment:
   Remove commented code.

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

Reply via email to