diff --git a/lib/elixir/lib/base.ex b/lib/elixir/lib/base.ex index 0c4ee4a159..6fe1fdfa4b 100644 --- a/lib/elixir/lib/base.ex +++ b/lib/elixir/lib/base.ex @@ -170,7 +170,6 @@ defmodule Base do "666f6f626172" """ - @spec encode16(binary) :: binary @spec encode16(binary, Keyword.t) :: binary def encode16(data, opts \\ []) when is_binary(data) do case = Keyword.get(opts, :case, :upper) @@ -204,7 +203,6 @@ defmodule Base do {:ok, "foobar"} """ - @spec decode16(binary) :: {:ok, binary} | :error @spec decode16(binary, Keyword.t) :: {:ok, binary} | :error def decode16(string, opts \\ []) do {:ok, decode16!(string, opts)} @@ -242,7 +240,6 @@ defmodule Base do "foobar" """ - @spec decode16!(binary) :: binary @spec decode16!(binary, Keyword.t) :: binary def decode16!(string, opts \\ []) @@ -273,7 +270,6 @@ defmodule Base do "Zm9vYg" """ - @spec encode64(binary) :: binary @spec encode64(binary, Keyword.t) :: binary def encode64(data, opts \\ []) when is_binary(data) do pad? = Keyword.get(opts, :padding, true) @@ -304,7 +300,6 @@ defmodule Base do {:ok, "foob"} """ - @spec decode64(binary) :: {:ok, binary} | :error @spec decode64(binary, Keyword.t) :: {:ok, binary} | :error def decode64(string, opts \\ []) when is_binary(string) do {:ok, decode64!(string, opts)} @@ -339,7 +334,6 @@ defmodule Base do "foob" """ - @spec decode64!(binary) :: binary @spec decode64!(binary, Keyword.t) :: binary def decode64!(string, opts \\ []) when is_binary(string) do pad? = Keyword.get(opts, :padding, true) @@ -362,7 +356,6 @@ defmodule Base do "_3_-_A" """ - @spec url_encode64(binary) :: binary @spec url_encode64(binary, Keyword.t) :: binary def url_encode64(data, opts \\ []) when is_binary(data) do pad? = Keyword.get(opts, :padding, true) @@ -391,7 +384,6 @@ defmodule Base do {:ok, <<255, 127, 254, 252>>} """ - @spec url_decode64(binary) :: {:ok, binary} | :error @spec url_decode64(binary, Keyword.t) :: {:ok, binary} | :error def url_decode64(string, opts \\ []) when is_binary(string) do {:ok, url_decode64!(string, opts)} @@ -424,7 +416,6 @@ defmodule Base do <<255, 127, 254, 252>> """ - @spec url_decode64!(binary) :: binary @spec url_decode64!(binary, Keyword.t) :: binary def url_decode64!(string, opts \\ []) when is_binary(string) do pad? = Keyword.get(opts, :padding, true) @@ -463,7 +454,6 @@ defmodule Base do "MZXW6YTBOI" """ - @spec encode32(binary) :: binary @spec encode32(binary, Keyword.t) :: binary def encode32(data, opts \\ []) when is_binary(data) do case = Keyword.get(opts, :case, :upper) @@ -507,7 +497,6 @@ defmodule Base do {:ok, "foobar"} """ - @spec decode32(binary) :: {:ok, binary} | :error @spec decode32(binary, Keyword.t) :: {:ok, binary} | :error def decode32(string, opts \\ []) do {:ok, decode32!(string, opts)} @@ -554,7 +543,6 @@ defmodule Base do "foobar" """ - @spec decode32!(binary) :: binary @spec decode32!(binary, Keyword.t) :: binary def decode32!(string, opts \\ []) when is_binary(string) do case = Keyword.get(opts, :case, :upper) @@ -595,7 +583,6 @@ defmodule Base do "CPNMUOJ1E8" """ - @spec hex_encode32(binary) :: binary @spec hex_encode32(binary, Keyword.t) :: binary def hex_encode32(data, opts \\ []) when is_binary(data) do case = Keyword.get(opts, :case, :upper) @@ -640,7 +627,6 @@ defmodule Base do {:ok, "foobar"} """ - @spec hex_decode32(binary) :: {:ok, binary} | :error @spec hex_decode32(binary, Keyword.t) :: {:ok, binary} | :error def hex_decode32(string, opts \\ []) do {:ok, hex_decode32!(string, opts)} @@ -688,7 +674,6 @@ defmodule Base do "foobar" """ - @spec hex_decode32!(binary) :: binary @spec hex_decode32!(binary, Keyword.t) :: binary def hex_decode32!(string, opts \\ []) when is_binary(string) do case = Keyword.get(opts, :case, :upper) diff --git a/lib/elixir/lib/enum.ex b/lib/elixir/lib/enum.ex index faf01645c5..a80fae0219 100644 --- a/lib/elixir/lib/enum.ex +++ b/lib/elixir/lib/enum.ex @@ -226,7 +226,6 @@ defmodule Enum do false """ - @spec all?(t) :: boolean @spec all?(t, (element -> as_boolean(term))) :: boolean def all?(enumerable, fun \\ fn(x) -> x end) @@ -264,7 +263,6 @@ defmodule Enum do true """ - @spec any?(t) :: boolean @spec any?(t, (element -> as_boolean(term))) :: boolean def any?(enumerable, fun \\ fn(x) -> x end) @@ -2650,7 +2648,6 @@ defmodule Enum do [a: 3, b: 4, c: 5] """ - @spec with_index(t) :: [{element, index}] @spec with_index(t, integer) :: [{element, index}] def with_index(enumerable, offset \\ 0) do map_reduce(enumerable, offset, fn x, acc -> diff --git a/lib/elixir/lib/keyword.ex b/lib/elixir/lib/keyword.ex index 10d126a835..bc007f563e 100644 --- a/lib/elixir/lib/keyword.ex +++ b/lib/elixir/lib/keyword.ex @@ -174,7 +174,6 @@ defmodule Keyword do 3 """ - @spec get(t, key) :: value @spec get(t, key, value) :: value def get(keywords, key, default \\ nil) when is_list(keywords) and is_atom(key) do case :lists.keyfind(key, 1, keywords) do diff --git a/lib/elixir/lib/macro.ex b/lib/elixir/lib/macro.ex index 70509a8046..5c477775b4 100644 --- a/lib/elixir/lib/macro.ex +++ b/lib/elixir/lib/macro.ex @@ -504,7 +504,6 @@ defmodule Macro do 1 """ - @spec escape(term) :: Macro.t @spec escape(term, Keyword.t) :: Macro.t def escape(expr, opts \\ []) do elem(:elixir_quote.escape(expr, Keyword.get(opts, :unquote, false)), 0) @@ -682,7 +681,6 @@ defmodule Macro do "one + two" """ - @spec to_string(Macro.t) :: String.t @spec to_string(Macro.t, (Macro.t, String.t -> String.t)) :: String.t def to_string(tree, fun \\ fn(_ast, string) -> string end) diff --git a/lib/elixir/lib/map.ex b/lib/elixir/lib/map.ex index c48a8aa0c4..2fb83af634 100644 --- a/lib/elixir/lib/map.ex +++ b/lib/elixir/lib/map.ex @@ -398,7 +398,6 @@ defmodule Map do 3 """ - @spec get(map, key) :: value @spec get(map, key, value) :: value def get(map, key, default \\ nil) do case fetch(map, key) do diff --git a/lib/elixir/lib/process.ex b/lib/elixir/lib/process.ex index fb4e57b3ec..3135b4b841 100644 --- a/lib/elixir/lib/process.ex +++ b/lib/elixir/lib/process.ex @@ -40,7 +40,6 @@ defmodule Process do Returns the value for the given `key` in the process dictionary, or `default` if `key` is not set. """ - @spec get(term) :: term @spec get(term, default :: term) :: term def get(key, default \\ nil) do case :erlang.get(key) do @@ -399,7 +398,6 @@ defmodule Process do Inlined by the compiler. """ - @spec demonitor(reference) :: true @spec demonitor(reference, options :: [:flush | :info]) :: boolean defdelegate demonitor(monitor_ref, options \\ []), to: :erlang diff --git a/lib/elixir/lib/stream.ex b/lib/elixir/lib/stream.ex index 93f8915061..aa69aaf423 100644 --- a/lib/elixir/lib/stream.ex +++ b/lib/elixir/lib/stream.ex @@ -155,7 +155,6 @@ defmodule Stream do [[1, 2, 3], [4, 5, 6]] """ - @spec chunk(Enumerable.t, pos_integer, pos_integer) :: Enumerable.t @spec chunk(Enumerable.t, pos_integer, pos_integer, Enumerable.t | nil) :: Enumerable.t def chunk(enum, n, step, leftover \\ nil) when is_integer(n) and n > 0 and is_integer(step) and step > 0 do @@ -954,7 +953,6 @@ defmodule Stream do [{1, 3}, {2, 4}, {3, 5}] """ - @spec with_index(Enumerable.t) :: Enumerable.t @spec with_index(Enumerable.t, integer) :: Enumerable.t def with_index(enum, offset \\ 0) do lazy enum, offset, fn(f1) -> R.with_index(f1) end diff --git a/lib/elixir/lib/string.ex b/lib/elixir/lib/string.ex index f229bb1d35..1aecfab8ab 100644 --- a/lib/elixir/lib/string.ex +++ b/lib/elixir/lib/string.ex @@ -347,7 +347,6 @@ defmodule String do ["1", "2", "3", "4"] """ - @spec split(t, pattern | Regex.t) :: [t] @spec split(t, pattern | Regex.t, Keyword.t) :: [t] def split(string, pattern, options \\ []) diff --git a/lib/elixir/lib/supervisor.ex b/lib/elixir/lib/supervisor.ex index 5f18659434..64c8f3c421 100644 --- a/lib/elixir/lib/supervisor.ex +++ b/lib/elixir/lib/supervisor.ex @@ -318,7 +318,6 @@ defmodule Supervisor do name, the supported values are described in the "Name registration" section in the `GenServer` module docs. """ - @spec start_link(module, term) :: on_start @spec start_link(module, term, options) :: on_start def start_link(module, arg, options \\ []) when is_list(options) do case Keyword.get(options, :name) do diff --git a/lib/elixir/lib/system.ex b/lib/elixir/lib/system.ex index 40d2496089..d42abb1814 100644 --- a/lib/elixir/lib/system.ex +++ b/lib/elixir/lib/system.ex @@ -462,7 +462,6 @@ defmodule System do System.halt(:abort) """ - @spec halt() :: no_return @spec halt(non_neg_integer | binary | :abort) :: no_return def halt(status \\ 0) @@ -494,7 +493,6 @@ defmodule System do System.stop(1) """ - @spec stop() :: no_return @spec stop(non_neg_integer | binary) :: no_return def stop(status \\ 0) diff --git a/lib/iex/test/iex/helpers_test.exs b/lib/iex/test/iex/helpers_test.exs index 20d54db17d..d9a3983436 100644 --- a/lib/iex/test/iex/helpers_test.exs +++ b/lib/iex/test/iex/helpers_test.exs @@ -188,16 +188,16 @@ defmodule IEx.HelpersTest do assert capture_io(fn -> s IEx.Remsh end) == "No specification for IEx.Remsh was found\n" # Test that it shows at least two specs - assert Enum.count(capture_io(fn -> s Enum end) |> String.split("\n"), fn line -> + assert Enum.count(capture_io(fn -> s Process end) |> String.split("\n"), fn line -> String.starts_with? line, "@spec" end) >= 2 - assert Enum.count(capture_io(fn -> s Enum.all? end) |> String.split("\n"), fn line -> + assert Enum.count(capture_io(fn -> s Process.demonitor end) |> String.split("\n"), fn line -> String.starts_with? line, "@spec" end) >= 2 - assert capture_io(fn -> s Enum.all?/1 end) == - "@spec all?(t()) :: boolean()\n" + assert capture_io(fn -> s Process.register/2 end) == + "@spec register(pid() | port(), atom()) :: true\n" assert capture_io(fn -> s struct end) == "@spec struct(module() | struct(), Enum.t()) :: struct()\n" end