public static DescriptorComparison CheckNumericCompatibility(string leftDeclaredDescriptor, string rightDeclaredDescriptor, string leftActualDescriptor, string rightActualDescriptor) { var ld = leftDeclaredDescriptor; var rd = rightDeclaredDescriptor; var leftNumeric = CodeFlow.IsPrimitiveOrUnboxableSupportedNumberOrBoolean(ld); var rightNumeric = CodeFlow.IsPrimitiveOrUnboxableSupportedNumberOrBoolean(rd); // If the declared descriptors aren't providing the information, try the actual descriptors if (!leftNumeric && !ObjectUtils.NullSafeEquals(ld, leftActualDescriptor)) { ld = leftActualDescriptor; leftNumeric = CodeFlow.IsPrimitiveOrUnboxableSupportedNumberOrBoolean(ld); } if (!rightNumeric && !ObjectUtils.NullSafeEquals(rd, rightActualDescriptor)) { rd = rightActualDescriptor; rightNumeric = CodeFlow.IsPrimitiveOrUnboxableSupportedNumberOrBoolean(rd); } if (leftNumeric && rightNumeric) { if (CodeFlow.AreBoxingCompatible(ld, rd)) { return(new DescriptorComparison(true, true, CodeFlow.ToPrimitiveTargetDesc(ld))); } else { return(_INCOMPATIBLE_NUMBERS); } } else { return(_NOT_NUMBERS); } }