void (DfaValueFactory factory, DfaMemoryState state, DfaCallArguments arguments, boolean list) { DfaVariableValue size = tryCast(COLLECTION_SIZE.createValue(factory, arguments.myQualifier), DfaVariableValue.class); DfaValue argSize = COLLECTION_SIZE.createValue(factory, ArrayUtil.getLastElement(arguments.myArguments)); if (size != null) { DfIntType sizeType = tryCast(state.getDfType(size), DfIntType.class); DfType argSizeType = tryCast(state.getDfType(argSize), DfIntType.class); DfType resultSize = COLLECTION_SIZE.getDefaultValue(); if (sizeType != null && argSizeType != null) { LongRangeSet totalRange = JvmPsiRangeSetUtil.indexRange(); if (!list) { LongRangeSet argSizeRange = DfIntType.extractRange(argSizeType); if (!argSizeRange.contains(0)) { // Adding non-empty collection to the set will produce non-empty set totalRange = totalRange.without(0); } LongRangeSet addedForSet = argSizeRange.fromRelation(RelationType.LE).meet(JvmPsiRangeSetUtil.indexRange()); argSizeType = argSizeType.join(DfTypes.intRange(addedForSet)); } resultSize = sizeType.eval(argSizeType, LongRangeBinOp.PLUS).meet(DfTypes.intRange(totalRange)); if (resultSize == DfType.BOTTOM) { // Possible int overflow resultSize = COLLECTION_SIZE.getDefaultValue(); } } updateState(state, size, resultSize); } }