Skip to content

Commit 208936b

Browse files
committed
Fewer ok
1 parent 89849ac commit 208936b

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

lib/elixir/lib/module/types/expr.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@ defmodule Module.Types.Expr do
305305
when not is_atom(callee) and is_atom(key_or_fun) do
306306
with {:ok, type, context} <- of_expr(callee, stack, context) do
307307
if Keyword.get(meta, :no_parens, false) do
308-
Of.map_fetch(expr, type, key_or_fun, stack, context)
308+
{type, context} = Of.map_fetch(expr, type, key_or_fun, stack, context)
309+
{:ok, type, context}
309310
else
310311
{mods, context} = Of.remote(type, key_or_fun, 0, [:dot], expr, meta, stack, context)
311312
{type, context} = apply_many(mods, key_or_fun, [], expr, stack, context)

lib/elixir/lib/module/types/of.ex

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,10 @@ defmodule Module.Types.Of do
7979
def map_fetch(expr, type, field, stack, context) when is_atom(field) do
8080
case map_fetch(type, field) do
8181
{_optional?, value_type} ->
82-
{:ok, value_type, context}
82+
{value_type, context}
8383

8484
reason ->
85-
{:ok, dynamic(),
86-
error({reason, expr, type, field, context}, elem(expr, 1), stack, context)}
85+
{dynamic(), error({reason, expr, type, field, context}, elem(expr, 1), stack, context)}
8786
end
8887
end
8988

lib/elixir/lib/module/types/pattern.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,8 @@ defmodule Module.Types.Pattern do
663663
def of_guard({{:., _, [callee, key]}, _, []} = map_fetch, _expected, expr, stack, context)
664664
when not is_atom(callee) do
665665
with {:ok, type, context} <- of_guard(callee, dynamic(), expr, stack, context) do
666-
Of.map_fetch(map_fetch, type, key, stack, context)
666+
{type, context} = Of.map_fetch(map_fetch, type, key, stack, context)
667+
{:ok, type, context}
667668
end
668669
end
669670

0 commit comments

Comments
 (0)