@@ -1365,44 +1365,20 @@ defmodule Module.Types.Descr do
13651365 # we have at least two key differences now, we switch strategy
13661366 # if both are subtypes in one direction, keep checking
13671367 cond do
1368- trivial_subtype ?( d1 , d2 ) and trivial_subtype ?( v1 , v2 ) -> :left_subtype_of_right
1369- trivial_subtype ?( d2 , d1 ) and trivial_subtype ?( v2 , v1 ) -> :right_subtype_of_left
1368+ subtype ?( d1 , d2 ) and subtype ?( v1 , v2 ) -> :left_subtype_of_right
1369+ subtype ?( d2 , d1 ) and subtype ?( v2 , v1 ) -> :right_subtype_of_left
13701370 true -> nil
13711371 end
13721372 end
13731373
13741374 defp map_union_next_strategy ( _key , v1 , v2 , :left_subtype_of_right ) do
1375- if trivial_subtype ?( v1 , v2 ) , do: :left_subtype_of_right
1375+ if subtype ?( v1 , v2 ) , do: :left_subtype_of_right
13761376 end
13771377
13781378 defp map_union_next_strategy ( _key , v1 , v2 , :right_subtype_of_left ) do
1379- if trivial_subtype ?( v2 , v1 ) , do: :right_subtype_of_left
1379+ if subtype ?( v2 , v1 ) , do: :right_subtype_of_left
13801380 end
13811381
1382- # cheap to compute sub-typing
1383- # a trivial subtype is always a subtype, but not all subtypes are subtypes
1384- defp trivial_subtype? ( _ , :term ) , do: true
1385- defp trivial_subtype? ( same , same ) , do: true
1386-
1387- defp trivial_subtype? ( % { } = left , % { } = right )
1388- when map_size ( left ) == 1 and map_size ( right ) == 1 do
1389- case { left , right } do
1390- { % { atom: _ } , % { atom: { :negation , neg } } } when neg == % { } ->
1391- true
1392-
1393- { % { map: _ } , % { map: [ { :open , pos , [ ] } ] } } when pos == % { } ->
1394- true
1395-
1396- { % { bitmap: bitmap1 } , % { bitmap: bitmap2 } } ->
1397- ( bitmap1 &&& bitmap2 ) === bitmap2
1398-
1399- _ ->
1400- false
1401- end
1402- end
1403-
1404- defp trivial_subtype? ( _ , _ ) , do: false
1405-
14061382 # Given two unions of maps, intersects each pair of maps.
14071383 defp map_intersection ( dnf1 , dnf2 ) do
14081384 for { tag1 , pos1 , negs1 } <- dnf1 ,
0 commit comments