@@ -303,7 +303,7 @@ defmodule Module.Types.DescrTest do
303303
304304 assert empty? ( intersection ( closed_map ( a: integer ( ) ) , closed_map ( a: atom ( ) ) ) )
305305
306- # Maps leaves are actually optimize , so some of the code branches
306+ # Maps leaves are actually optimized , so some of the code branches
307307 # can only be tested through negations. This is the intersection between
308308 # open_map(a: integer()) and open_map(b: integer())
309309 a_and_b =
@@ -317,6 +317,16 @@ defmodule Module.Types.DescrTest do
317317 ) ,
318318 a_and_b
319319 )
320+
321+ # This is a regression triggered by an optimization
322+ assert intersection (
323+ closed_map ( tag: atom ( [ true ] ) , halted: atom ( [ true ] ) , assigns: term ( ) ) ,
324+ union (
325+ closed_map ( tag: atom ( [ true ] ) , halted: atom ( [ true ] ) , assigns: term ( ) ) ,
326+ closed_map ( tag: atom ( [ true ] ) , halted: term ( ) , assigns: open_map ( ) )
327+ )
328+ )
329+ |> equal? ( closed_map ( tag: atom ( [ true ] ) , halted: atom ( [ true ] ) , assigns: term ( ) ) )
320330 end
321331
322332 test "map with domain keys" do
@@ -367,13 +377,10 @@ defmodule Module.Types.DescrTest do
367377
368378 t1 = closed_map ( [ { domain_key ( :integer ) , atom ( ) } ] )
369379 t2 = closed_map ( [ { domain_key ( :integer ) , binary ( ) } ] )
370-
371380 assert equal? ( intersection ( t1 , t2 ) , empty_map ( ) )
372381
373382 t1 = closed_map ( [ { domain_key ( :integer ) , atom ( ) } ] )
374383 t2 = closed_map ( [ { domain_key ( :atom ) , term ( ) } ] )
375-
376- # their intersection is the empty map
377384 refute empty? ( intersection ( t1 , t2 ) )
378385 assert equal? ( intersection ( t1 , t2 ) , empty_map ( ) )
379386 end
0 commit comments