@@ -896,6 +896,24 @@ defmodule Module.Types.PatternTest do
896896 """
897897 end
898898
899+ test "nested conditional checks" do
900+ assert typecheck! ( [ a , b ] , true == ( b and a ) , a ) == dynamic ( atom ( [ true ] ) )
901+ assert typecheck! ( [ a , b ] , false == ( b and a ) , a ) == dynamic ( term ( ) )
902+
903+ assert typecheck! ( [ a , b , c ] , a != ( b or c ) , a ) == dynamic ( term ( ) )
904+ assert typecheck! ( [ a , b , c ] , a == ( b or c ) , a ) == dynamic ( term ( ) )
905+ assert typecheck! ( [ a , b , c ] , a !== ( b or c ) , a ) == dynamic ( term ( ) )
906+ assert typecheck! ( [ a , b , c ] , a === ( b or c ) , a ) == dynamic ( term ( ) )
907+ assert typecheck! ( [ a , b , c ] , a == hd ( b or c ) , a ) == dynamic ( term ( ) )
908+ assert typecheck! ( [ a , b , c ] , a != ( b and c ) , a ) == dynamic ( term ( ) )
909+ assert typecheck! ( [ a , b , c ] , a == ( b and c ) , a ) == dynamic ( term ( ) )
910+
911+ assert typecheck! ( [ a , b , c ] , a == :erlang . and ( b , c ) , a ) == dynamic ( boolean ( ) )
912+ assert typecheck! ( [ a , b , c ] , a == :erlang . or ( b , c ) , a ) == dynamic ( boolean ( ) )
913+ assert typecheck! ( [ a , b , c ] , c and a === ( b or c ) , a ) == dynamic ( atom ( [ true ] ) )
914+ assert typecheck! ( [ a , b , c ] , c and a === ( b and c ) , a ) == dynamic ( boolean ( ) )
915+ end
916+
899917 test "domain checks" do
900918 # Regular domain check
901919 assert typecheck! ( [ x , z ] , length ( x ) == z , x ) == dynamic ( list ( term ( ) ) )
0 commit comments