@@ -644,13 +644,8 @@ defmodule Module.Types.DescrTest do
644644 refute subtype? ( fun ( [ ] , term ( ) ) , fun ( [ ] , float ( ) ) )
645645
646646 # Contravariance of domain
647- union_args = fun ( [ union ( integer ( ) , atom ( ) ) ] , boolean ( ) )
648- int_arg = fun ( [ integer ( ) ] , boolean ( ) )
649- atom_arg = fun ( [ atom ( ) ] , boolean ( ) )
650-
651- assert subtype? ( union_args , int_arg )
652- assert subtype? ( intersection ( int_arg , atom_arg ) , union_args )
653- refute subtype? ( atom_arg , union_args )
647+ assert subtype? ( fun ( [ integer ( ) ] , boolean ( ) ) , fun ( [ number ( ) ] , boolean ( ) ) )
648+ refute subtype? ( fun ( [ number ( ) ] , boolean ( ) ) , fun ( [ integer ( ) ] , boolean ( ) ) )
654649
655650 # Nested function types
656651 higher_order = fun ( [ fun ( [ integer ( ) ] , atom ( ) ) ] , boolean ( ) )
@@ -659,17 +654,14 @@ defmodule Module.Types.DescrTest do
659654 assert subtype? ( higher_order , specific )
660655 refute subtype? ( specific , higher_order )
661656
662- ## Special multi -arity test
657+ ## Multi -arity
663658 f = fun ( [ none ( ) , integer ( ) ] , atom ( ) )
664659 assert subtype? ( f , f )
665660 assert subtype? ( f , fun ( [ none ( ) , integer ( ) ] , term ( ) ) )
666-
667661 assert subtype? ( fun ( [ none ( ) , number ( ) ] , atom ( ) ) , f )
668662 assert subtype? ( fun ( [ tuple ( ) , number ( ) ] , atom ( ) ) , f )
669-
670663 refute subtype? ( fun ( [ none ( ) , float ( ) ] , atom ( ) ) , f )
671664 refute subtype? ( fun ( [ pid ( ) , float ( ) ] , atom ( ) ) , f )
672-
673665 # A function with the wrong arity is refused
674666 refute subtype? ( fun ( [ none ( ) ] , atom ( ) ) , f )
675667 end
0 commit comments