List<PyType> (@NotNull List<PyType> argumentTypes, @NotNull List<PyType> typesByModifications) { if (argumentTypes.size() == 1) { final PyType type = ContainerUtil.getFirstItem(argumentTypes); if (type instanceof PyTupleType tuple) { argumentTypes = new ArrayList<>(tuple.getElementTypes()); } else if (type == null) { argumentTypes.add(null); } } if (typesByModifications.size() == 2) { if (argumentTypes.size() == 2) { argumentTypes.set(0, PyUnionType.union(argumentTypes.get(0), typesByModifications.get(0))); argumentTypes.set(1, PyUnionType.union(argumentTypes.get(1), typesByModifications.get(1))); } else { argumentTypes = typesByModifications; } } return argumentTypes; }