@@ -2241,6 +2241,55 @@ defmodule Module.Types.DescrTest do
22412241 map = closed_map ( [ { :a , atom ( [ :a ] ) } , { :__struct__ , term ( ) } , { domain_key ( :atom ) , pid ( ) } ] )
22422242 { :ok , term } = map_get ( map , atom ( ) |> difference ( atom ( [ :a ] ) ) )
22432243 assert equal? ( term , term ( ) )
2244+
2245+ base = open_map ( [ { domain_key ( :atom ) , term ( ) } ] )
2246+ bad = open_map ( a: if_set ( negation ( integer ( ) ) ) )
2247+ map = negation ( union ( negation ( base ) , bad ) )
2248+
2249+ assert equal? ( map , open_map ( a: integer ( ) ) )
2250+
2251+ { :ok , type } = map_get ( map , atom ( ) )
2252+ assert equal? ( type , term ( ) )
2253+
2254+ { :ok , type } = map_get ( map , atom ( [ :a ] ) )
2255+ assert equal? ( type , integer ( ) )
2256+
2257+ map = closed_map ( [ { :a , term ( ) } , { domain_key ( :atom ) , integer ( ) } ] )
2258+
2259+ { :ok , type } = map_get ( map , atom ( ) )
2260+ assert equal? ( type , term ( ) )
2261+
2262+ { :ok , type } = map_get ( map , atom ( [ :a ] ) )
2263+ assert equal? ( type , term ( ) )
2264+
2265+ { :ok , type } = map_get ( map , difference ( atom ( ) , atom ( [ :a ] ) ) )
2266+ assert equal? ( type , integer ( ) )
2267+
2268+ map =
2269+ closed_map ( [ { :a , term ( ) } , { domain_key ( :atom ) , integer ( ) } ] )
2270+ |> difference ( open_map ( a: negation ( pid ( ) ) ) )
2271+
2272+ { :ok , type } = map_get ( map , atom ( ) )
2273+ assert equal? ( type , union ( integer ( ) , pid ( ) ) )
2274+
2275+ { :ok , type } = map_get ( map , atom ( [ :a ] ) )
2276+ assert equal? ( type , pid ( ) )
2277+
2278+ { :ok , type } = map_get ( map , difference ( atom ( ) , atom ( [ :a ] ) ) )
2279+ assert equal? ( type , integer ( ) )
2280+
2281+ map =
2282+ closed_map ( [ { :a , term ( ) } , { :b , binary ( ) } , { domain_key ( :atom ) , integer ( ) } ] )
2283+ |> difference ( open_map ( a: negation ( pid ( ) ) ) )
2284+
2285+ { :ok , type } = map_get ( map , atom ( ) )
2286+ assert equal? ( type , union ( union ( integer ( ) , pid ( ) ) , binary ( ) ) )
2287+
2288+ { :ok , type } = map_get ( map , atom ( [ :a , :b ] ) )
2289+ assert equal? ( type , union ( pid ( ) , binary ( ) ) )
2290+
2291+ { :ok , type } = map_get ( map , difference ( atom ( ) , atom ( [ :a , :b ] ) ) )
2292+ assert equal? ( type , integer ( ) )
22442293 end
22452294
22462295 test "with lists" do
0 commit comments