@@ -605,6 +605,7 @@ pub(crate) mod test {
605
605
use crate :: extension:: PRELUDE ;
606
606
use crate :: std_extensions:: arithmetic:: int_types:: ConstInt ;
607
607
use crate :: std_extensions:: collections:: array:: { array_type, ArrayValue } ;
608
+ use crate :: std_extensions:: collections:: value_array:: { value_array_type, VArrayValue } ;
608
609
use crate :: {
609
610
builder:: { BuildError , DFGBuilder , Dataflow , DataflowHugr } ,
610
611
extension:: {
@@ -778,6 +779,11 @@ pub(crate) mod test {
778
779
ArrayValue :: new ( bool_t ( ) , [ Value :: true_val ( ) , Value :: false_val ( ) ] ) . into ( )
779
780
}
780
781
782
+ #[ fixture]
783
+ fn const_value_array_bool ( ) -> Value {
784
+ VArrayValue :: new ( bool_t ( ) , [ Value :: true_val ( ) , Value :: false_val ( ) ] ) . into ( )
785
+ }
786
+
781
787
#[ fixture]
782
788
fn const_array_options ( ) -> Value {
783
789
let some_true = Value :: some ( [ Value :: true_val ( ) ] ) ;
@@ -786,17 +792,35 @@ pub(crate) mod test {
786
792
ArrayValue :: new ( elem_ty. into ( ) , [ some_true, none] ) . into ( )
787
793
}
788
794
795
+ #[ fixture]
796
+ fn const_value_array_options ( ) -> Value {
797
+ let some_true = Value :: some ( [ Value :: true_val ( ) ] ) ;
798
+ let none = Value :: none ( vec ! [ bool_t( ) ] ) ;
799
+ let elem_ty = SumType :: new_option ( vec ! [ bool_t( ) ] ) ;
800
+ VArrayValue :: new ( elem_ty. into ( ) , [ some_true, none] ) . into ( )
801
+ }
802
+
789
803
#[ rstest]
790
804
#[ case( Value :: unit( ) , Type :: UNIT , "const:seq:{}" ) ]
791
805
#[ case( const_usize( ) , usize_t( ) , "const:custom:ConstUsize(" ) ]
792
806
#[ case( serialized_float( 17.4 ) , float64_type( ) , "const:custom:json:Object" ) ]
793
807
#[ case( const_tuple( ) , Type :: new_tuple( vec![ usize_t( ) , bool_t( ) ] ) , "const:seq:{" ) ]
794
808
#[ case( const_array_bool( ) , array_type( 2 , bool_t( ) ) , "const:custom:array" ) ]
809
+ #[ case(
810
+ const_value_array_bool( ) ,
811
+ value_array_type( 2 , bool_t( ) ) ,
812
+ "const:custom:value_array"
813
+ ) ]
795
814
#[ case(
796
815
const_array_options( ) ,
797
816
array_type( 2 , SumType :: new_option( vec![ bool_t( ) ] ) . into( ) ) ,
798
817
"const:custom:array"
799
818
) ]
819
+ #[ case(
820
+ const_value_array_options( ) ,
821
+ value_array_type( 2 , SumType :: new_option( vec![ bool_t( ) ] ) . into( ) ) ,
822
+ "const:custom:value_array"
823
+ ) ]
800
824
fn const_type (
801
825
#[ case] const_value : Value ,
802
826
#[ case] expected_type : Type ,
@@ -816,7 +840,9 @@ pub(crate) mod test {
816
840
#[ case( const_serialized_usize( ) , const_usize( ) ) ]
817
841
#[ case( const_tuple_serialized( ) , const_tuple( ) ) ]
818
842
#[ case( const_array_bool( ) , const_array_bool( ) ) ]
843
+ #[ case( const_value_array_bool( ) , const_value_array_bool( ) ) ]
819
844
#[ case( const_array_options( ) , const_array_options( ) ) ]
845
+ #[ case( const_value_array_options( ) , const_value_array_options( ) ) ]
820
846
// Opaque constants don't get resolved into concrete types when running miri,
821
847
// as the `typetag` machinery is not available.
822
848
#[ cfg_attr( miri, ignore) ]
0 commit comments