From f6aa2a48b763bcd7a1bfa49c40df172924bb9736 Mon Sep 17 00:00:00 2001 From: pnezis Date: Fri, 3 Jul 2026 13:53:34 +0300 Subject: [PATCH] Fix spec of `File.copy/3` --- lib/elixir/lib/file.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/elixir/lib/file.ex b/lib/elixir/lib/file.ex index 917c5075958..10ba808ea26 100644 --- a/lib/elixir/lib/file.ex +++ b/lib/elixir/lib/file.ex @@ -897,7 +897,7 @@ defmodule File do File.copy("non_existing.txt", "copy.txt") #=> {:error, :enoent} """ - @spec copy(Path.t() | io_device, Path.t() | io_device, pos_integer | :infinity) :: + @spec copy(Path.t() | io_device, Path.t() | io_device, non_neg_integer | :infinity) :: {:ok, non_neg_integer} | {:error, posix | :badarg | :terminated} def copy(source, destination, bytes_count \\ :infinity) do source = normalize_path_or_io_device(source) @@ -918,7 +918,7 @@ defmodule File do File.copy!("non_existing.txt", "copy.txt") ** (File.CopyError) could not copy from "non_existing.txt" to "copy.txt": no such file or directory """ - @spec copy!(Path.t() | io_device, Path.t() | io_device, pos_integer | :infinity) :: + @spec copy!(Path.t() | io_device, Path.t() | io_device, non_neg_integer | :infinity) :: non_neg_integer def copy!(source, destination, bytes_count \\ :infinity) do case copy(source, destination, bytes_count) do