From 08f6bbd031b1e7e7ed90dddd321fc0ac4663d4e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 18 Sep 2020 10:41:22 +0200 Subject: [PATCH] Align doc chunks return with EEP 48 --- lib/elixir/lib/behaviour.ex | 4 ++-- lib/elixir/lib/code.ex | 2 +- lib/elixir/lib/kernel/typespec.ex | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/elixir/lib/behaviour.ex b/lib/elixir/lib/behaviour.ex index 4a09938aa9..25ab6e0c0c 100644 --- a/lib/elixir/lib/behaviour.ex +++ b/lib/elixir/lib/behaviour.ex @@ -111,9 +111,9 @@ defmodule Behaviour do end end - defp __behaviour__doc_value(:none), do: nil - defp __behaviour__doc_value(:hidden), do: false defp __behaviour__doc_value(%{"en" => doc}), do: doc + defp __behaviour__doc_value(:hidden), do: false + defp __behaviour__doc_value(_), do: nil import unquote(__MODULE__) end diff --git a/lib/elixir/lib/code.ex b/lib/elixir/lib/code.ex index e4cb2f7abf..4bd32b993c 100644 --- a/lib/elixir/lib/code.ex +++ b/lib/elixir/lib/code.ex @@ -1348,7 +1348,7 @@ defmodule Code do | {:error, :module_not_found | :chunk_not_found | {:invalid_chunk, binary}} when annotation: :erl_anno.anno(), beam_language: :elixir | :erlang | atom(), - doc_content: %{required(binary) => binary} | :none | :hidden, + doc_content: %{optional(binary) => binary} | :none | :hidden, doc_element: {{kind :: atom, function_name :: atom, arity}, annotation, signature, doc_content, metadata}, diff --git a/lib/elixir/lib/kernel/typespec.ex b/lib/elixir/lib/kernel/typespec.ex index 7f56b3cd9c..f28c3dbf53 100644 --- a/lib/elixir/lib/kernel/typespec.ex +++ b/lib/elixir/lib/kernel/typespec.ex @@ -23,6 +23,7 @@ defmodule Kernel.Typespec do for {{:type, name, arity}, _, _, doc, _} <- docs do case doc do %{"en" => doc_string} -> {{name, arity}, doc_string} + %{} -> {{name, arity}, nil} :none -> {{name, arity}, nil} # Hidden or unknown format are ignored _ -> {{name, arity}, false}