code: protected TypeData mergeTypeData(final XExpression expression, List<TypeData> allValues, boolean returnType, boolean nullIfEmpty) {
  		int allSize = allValues.size();
  		if (nullIfEmpty && allSize == 0) {
  			return null;
  		}
  		final List<TypeData> values;
  		if (allSize == 1) {
  			TypeData result = allValues.get(0);
  			if (result.isReturnType() == returnType) {
  				return getSingleMergeResult(result, expression, returnType);
  			}
  			if (nullIfEmpty)
  				return null;
  			if (returnType) {
  				return getSingleMergeResult(result, expression, returnType);
  			}
  			values = Collections.emptyList();
  		} else {
  			values = collectValues(allValues, returnType);
  		}
  		if (nullIfEmpty && values.size() == 0) {
  			return null;
  		}
  		if (values.size() == 1) {
  			TypeData typeData = values.get(0);
  			return getSingleMergeResult(typeData, expression, returnType);
  		}
  		MergeData mergeData = new MergeData();
  		enhanceMergeData(values, mergeData);
  		LightweightTypeReference mergedType = getMergedType(mergeData, values);
  		// TODO improve - return error type information
  		if (mergedType == null)
  			return null;
  		if (mergeData.expectation == null) {
  			throw new IllegalStateException("Expectation should never be null here");
  		}
  		mergedType = refineMergedType(mergeData, mergedType, returnType, nullIfEmpty);
  		TypeData result = new TypeData(expression, mergeData.expectation, mergedType, mergeData.mergedFlags , returnType);
  		return result;
  	}
docs: /* @Nullable