@@ -6,10 +6,10 @@ defmodule Module.Types.Of do
66 @ prefix quote ( do: ... )
77 @ suffix quote ( do: ... )
88
9- alias Module.Types.Unify
109 alias Module.ParallelChecker
1110
1211 import Module.Types.Helpers
12+ import Module.Types.Unify
1313
1414 @ doc """
1515 Handles open maps (with dynamic => dynamic).
@@ -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 } -> Unify . has_unbound_var? ( key , context ) end ) do
43+ case Enum . split_with ( pairs , fn { key , _value } -> 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 , Unify . to_union ( all_values , context ) } | behind ] , context )
60+ pairs_to_unions ( ahead , [ { key , to_union ( all_values , context ) } | behind ] , context )
6161 end
6262
6363 defp pairs_to_unions ( [ ] , acc , context ) do
6464 acc
65- |> Enum . sort ( & Unify . subtype? ( elem ( & 1 , 0 ) , elem ( & 2 , 0 ) , context ) )
65+ |> Enum . sort ( & 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 , Unify . subtype? ( pair_key , key , context ) , do: pair_value
70+ for { pair_key , pair_value } <- pairs , subtype? ( pair_key , key , context ) , do: pair_value
7171 end
7272
7373 defp find_matching_values ( [ { key , value } | ahead ] , key , acc , values ) do
@@ -153,16 +153,11 @@ defmodule Module.Types.Of do
153153
154154 true ->
155155 with { :ok , type , context } <- fun . ( expr , stack , context ) ,
156- { :ok , _type , context } <- Unify . unify ( type , expected_type , stack , context ) ,
156+ { :ok , _type , context } <- unify ( type , expected_type , stack , context ) ,
157157 do: { :ok , context }
158158 end
159159 end
160160
161- # TODO: Remove this clause once we properly handle comprehensions
162- defp binary_segment ( { :<- , _ , _ } , _stack , context , _fun ) do
163- { :ok , context }
164- end
165-
166161 # Collect binary type specifiers,
167162 # from `<<pattern::integer-size(10)>>` collect `integer`
168163 defp collect_binary_specifier ( { :- , _meta , [ left , right ] } , fun ) do
0 commit comments