@@ -777,7 +777,7 @@ defmodule Module.Types.DescrTest do
777777      assert  fun_apply ( fun1 ,  [ integer ( ) ] )  ==  { :ok ,  atom ( ) } 
778778      assert  fun_apply ( fun1 ,  [ float ( ) ] )  ==  { :ok ,  term ( ) } 
779779
780-       # Function intersection with unions and dynamic return  
780+       # Function intersection with unions 
781781      fun2  = 
782782        intersection ( 
783783          fun ( [ union ( integer ( ) ,  atom ( ) ) ] ,  term ( ) ) , 
@@ -798,6 +798,25 @@ defmodule Module.Types.DescrTest do
798798      assert  fun_apply ( fun3 ,  [ atom ( [ :ok ] ) ] )  ==  { :ok ,  none ( ) } 
799799    end 
800800
801+     test  "static with dynamic signature"  do 
802+       assert  fun_apply ( fun ( [ dynamic ( ) ] ,  term ( ) ) ,  [ dynamic ( ) ] )  ==  { :ok ,  term ( ) } 
803+       assert  fun_apply ( fun ( [ integer ( ) ] ,  dynamic ( ) ) ,  [ integer ( ) ] )  ==  { :ok ,  dynamic ( ) } 
804+ 
805+       assert  fun_apply ( fun ( [ dynamic ( ) ] ,  integer ( ) ) ,  [ dynamic ( ) ] ) 
806+              |>  elem ( 1 ) 
807+              |>  equal? ( integer ( ) ) 
808+ 
809+       assert  fun_apply ( fun ( [ dynamic ( ) ,  atom ( ) ] ,  float ( ) ) ,  [ dynamic ( ) ,  atom ( ) ] ) 
810+              |>  elem ( 1 ) 
811+              |>  equal? ( float ( ) ) 
812+ 
813+       fun  =  fun ( [ dynamic ( integer ( ) ) ] ,  atom ( ) ) 
814+       assert  fun_apply ( fun ,  [ dynamic ( integer ( ) ) ] )  |>  elem ( 1 )  |>  equal? ( atom ( ) ) 
815+       assert  fun_apply ( fun ,  [ dynamic ( number ( ) ) ] )  ==  :badarg 
816+       assert  fun_apply ( fun ,  [ integer ( ) ] )  ==  :badarg 
817+       assert  fun_apply ( fun ,  [ float ( ) ] )  ==  :badarg 
818+     end 
819+ 
801820    defp  dynamic_fun ( args ,  return ) ,  do:  dynamic ( fun ( args ,  return ) ) 
802821
803822    test  "dynamic"  do 
@@ -1689,11 +1708,14 @@ defmodule Module.Types.DescrTest do
16891708      assert  fun ( )  |>  to_quoted_string ( )  ==  "fun()" 
16901709      assert  fun ( 1 )  |>  to_quoted_string ( )  ==  "(none() -> term())" 
16911710
1692-       assert  fun ( [ integer ( ) ,   float ( ) ] ,  boolean ( ) )  |>  to_quoted_string ( )  == 
1693-                "(integer(),  float()  -> boolean ())" 
1711+       assert  fun ( [ dynamic ( integer ( ) ) ] ,  float ( ) )  |>  to_quoted_string ( )  == 
1712+                "dynamic((none() ->  float())) or (integer()  -> float ())" 
16941713
16951714      assert  fun ( [ integer ( ) ,  float ( ) ] ,  dynamic ( ) )  |>  to_quoted_string ( )  == 
1696-                "dynamic((integer(), float() -> term()))" 
1715+                "dynamic((integer(), float() -> term())) or (integer(), float() -> none())" 
1716+ 
1717+       assert  fun ( [ integer ( ) ,  float ( ) ] ,  boolean ( ) )  |>  to_quoted_string ( )  == 
1718+                "(integer(), float() -> boolean())" 
16971719
16981720      assert  fun ( [ integer ( ) ] ,  boolean ( ) ) 
16991721             |>  union ( fun ( [ float ( ) ] ,  boolean ( ) ) ) 
0 commit comments