Skip to content

Commit 6042fd0

Browse files
committed
Infer -> Unify
1 parent 475b73b commit 6042fd0

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

lib/elixir/lib/module/types.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ defmodule Module.Types do
66
end
77

88
import Module.Types.Helpers
9-
alias Module.Types.{Expr, Pattern, Infer}
9+
alias Module.Types.{Expr, Pattern, Unify}
1010

1111
@doc false
1212
def warnings(module, file, defs, no_warn_undefined, cache) do
@@ -300,9 +300,9 @@ defmodule Module.Types do
300300

301301
[
302302
"incompatible types:\n\n ",
303-
Infer.format_type(left, simplify_left?),
303+
Unify.format_type(left, simplify_left?),
304304
" !~ ",
305-
Infer.format_type(right, simplify_right?),
305+
Unify.format_type(right, simplify_right?),
306306
"\n\n",
307307
format_expr(expr, location),
308308
traces,
@@ -352,7 +352,7 @@ defmodule Module.Types do
352352
"where \"",
353353
Macro.to_string(var),
354354
"\" was given the type ",
355-
Infer.format_type(type, simplify?),
355+
Unify.format_type(type, simplify?),
356356
hint,
357357
" in:\n\n # ",
358358
format_location(location),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ defmodule Module.Types.Expr do
22
@moduledoc false
33

44
alias Module.Types.{Of, Pattern}
5-
import Module.Types.{Helpers, Infer}
5+
import Module.Types.{Helpers, Unify}
66

77
def of_expr(expr, %{context: stack_context} = stack, context) when stack_context != :expr do
88
of_expr(expr, %{stack | context: :expr}, context)

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ defmodule Module.Types.Of do
66
@prefix quote(do: ...)
77
@suffix quote(do: ...)
88

9-
alias Module.Types.Infer
9+
alias Module.Types.Unify
1010
alias Module.ParallelChecker
1111

1212
import Module.Types.Helpers
@@ -40,7 +40,7 @@ defmodule Module.Types.Of do
4040
defp pairs_to_unions([{key, value}], _context), do: [{:required, key, value}]
4141

4242
defp pairs_to_unions(pairs, context) do
43-
case Enum.split_with(pairs, fn {key, _value} -> Infer.has_unbound_var?(key, context) end) do
43+
case Enum.split_with(pairs, fn {key, _value} -> Unify.has_unbound_var?(key, context) end) do
4444
{[], pairs} -> pairs_to_unions(pairs, [], context)
4545
{[_ | _], pairs} -> pairs_to_unions([{:dynamic, :dynamic} | pairs], [], context)
4646
end
@@ -57,17 +57,17 @@ defmodule Module.Types.Of do
5757
find_subtype_values(ahead, key, context) ++
5858
find_subtype_values(behind, key, context)
5959

60-
pairs_to_unions(ahead, [{key, Infer.to_union(all_values, context)} | behind], context)
60+
pairs_to_unions(ahead, [{key, Unify.to_union(all_values, context)} | behind], context)
6161
end
6262

6363
defp pairs_to_unions([], acc, context) do
6464
acc
65-
|> Enum.sort(&Infer.subtype?(elem(&1, 0), elem(&2, 0), context))
65+
|> Enum.sort(&Unify.subtype?(elem(&1, 0), elem(&2, 0), context))
6666
|> Enum.map(fn {key, value} -> {:required, key, value} end)
6767
end
6868

6969
defp find_subtype_values(pairs, key, context) do
70-
for {pair_key, pair_value} <- pairs, Infer.subtype?(pair_key, key, context), do: pair_value
70+
for {pair_key, pair_value} <- pairs, Unify.subtype?(pair_key, key, context), do: pair_value
7171
end
7272

7373
defp find_matching_values([{key, value} | ahead], key, acc, values) do
@@ -153,7 +153,7 @@ defmodule Module.Types.Of do
153153

154154
true ->
155155
with {:ok, type, context} <- fun.(expr, stack, context),
156-
{:ok, _type, context} <- Infer.unify(type, expected_type, stack, context),
156+
{:ok, _type, context} <- Unify.unify(type, expected_type, stack, context),
157157
do: {:ok, context}
158158
end
159159
end

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ defmodule Module.Types.Pattern do
22
@moduledoc false
33

44
alias Module.Types.Of
5-
import Module.Types.{Helpers, Infer}
5+
import Module.Types.{Helpers, Unify}
66

77
@doc """
88
Handles patterns and guards at once.

lib/elixir/lib/module/types/infer.ex renamed to lib/elixir/lib/module/types/unify.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defmodule Module.Types.Infer do
1+
defmodule Module.Types.Unify do
22
@moduledoc false
33

44
import Module.Types.Helpers

lib/elixir/src/elixir_compiler.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ bootstrap_files() ->
166166
<<"lib/elixir/lib/module/locals_tracker.ex">>,
167167
<<"lib/elixir/lib/module/parallel_checker.ex">>,
168168
<<"lib/elixir/lib/module/types/helpers.ex">>,
169+
<<"lib/elixir/lib/module/types/unify.ex">>,
169170
<<"lib/elixir/lib/module/types/of.ex">>,
170-
<<"lib/elixir/lib/module/types/infer.ex">>,
171171
<<"lib/elixir/lib/module/types/pattern.ex">>,
172172
<<"lib/elixir/lib/module/types/expr.ex">>,
173173
<<"lib/elixir/lib/module/types.ex">>,

lib/elixir/test/elixir/module/types/infer_test.exs renamed to lib/elixir/test/elixir/module/types/unify_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Code.require_file("../../test_helper.exs", __DIR__)
22

3-
defmodule Module.Types.InferTest do
3+
defmodule Module.Types.UnifyTest do
44
use ExUnit.Case, async: true
5-
import Module.Types.Infer
5+
import Module.Types.Unify
66
alias Module.Types
77

88
defp unify_lift(left, right, context \\ new_context()) do

0 commit comments

Comments
 (0)