@@ -2,16 +2,18 @@ use cool_asserts::assert_matches;
2
2
3
3
use super :: * ;
4
4
use crate :: builder:: test:: closed_dfg_root_hugr;
5
+ #[ cfg( feature = "extension_inference" ) ]
6
+ use crate :: builder:: ModuleBuilder ;
5
7
use crate :: builder:: {
6
8
BuildError , Container , Dataflow , DataflowHugr , DataflowSubContainer , FunctionBuilder ,
7
- ModuleBuilder ,
8
9
} ;
9
10
use crate :: extension:: prelude:: { BOOL_T , PRELUDE , USIZE_T } ;
10
11
use crate :: extension:: {
11
12
Extension , ExtensionId , ExtensionSet , TypeDefBound , EMPTY_REG , PRELUDE_REGISTRY ,
12
13
} ;
13
14
use crate :: hugr:: hugrmut:: sealed:: HugrMutInternals ;
14
15
use crate :: hugr:: { HugrError , HugrMut , NodeType } ;
16
+ #[ cfg( feature = "extension_inference" ) ]
15
17
use crate :: macros:: const_extension_ids;
16
18
use crate :: ops:: dataflow:: IOTrait ;
17
19
use crate :: ops:: { self , Const , LeafOp , OpType } ;
@@ -23,6 +25,7 @@ use crate::values::Value;
23
25
use crate :: { type_row, Direction , IncomingPort , Node } ;
24
26
25
27
const NAT : Type = crate :: extension:: prelude:: USIZE_T ;
28
+ #[ cfg( feature = "infer_extensions" ) ]
26
29
const Q : Type = crate :: extension:: prelude:: QB_T ;
27
30
28
31
/// Creates a hugr with a single function definition that copies a bit `copies` times.
@@ -71,6 +74,7 @@ fn add_df_children(b: &mut Hugr, parent: Node, copies: usize) -> (Node, Node, No
71
74
/// Intended to be used to populate a BasicBlock node in a CFG.
72
75
///
73
76
/// Returns the node indices of each of the operations.
77
+ #[ cfg( feature = "infer_extensions" ) ]
74
78
fn add_block_children (
75
79
b : & mut Hugr ,
76
80
parent : Node ,
@@ -257,6 +261,7 @@ fn df_children_restrictions() {
257
261
) ;
258
262
}
259
263
264
+ #[ cfg( feature = "extension_inference" ) ]
260
265
#[ test]
261
266
/// Validation errors in a dataflow subgraph.
262
267
fn cfg_children_restrictions ( ) {
@@ -404,6 +409,7 @@ fn test_ext_edge() -> Result<(), HugrError> {
404
409
Ok ( ( ) )
405
410
}
406
411
412
+ #[ cfg( feature = "extension_inference" ) ]
407
413
const_extension_ids ! {
408
414
const XA : ExtensionId = "A" ;
409
415
const XB : ExtensionId = "BOOL_EXT" ;
@@ -441,6 +447,7 @@ fn test_local_const() -> Result<(), HugrError> {
441
447
Ok ( ( ) )
442
448
}
443
449
450
+ #[ cfg( feature = "extension_inference" ) ]
444
451
#[ test]
445
452
/// A wire with no extension requirements is wired into a node which has
446
453
/// [A,BOOL_T] extensions required on its inputs and outputs. This could be fixed
@@ -474,6 +481,7 @@ fn missing_lift_node() -> Result<(), BuildError> {
474
481
Ok ( ( ) )
475
482
}
476
483
484
+ #[ cfg( feature = "extension_inference" ) ]
477
485
#[ test]
478
486
/// A wire with extension requirement `[A]` is wired into a an output with no
479
487
/// extension req. In the validation extension typechecking, we don't do any
@@ -505,6 +513,7 @@ fn too_many_extension() -> Result<(), BuildError> {
505
513
Ok ( ( ) )
506
514
}
507
515
516
+ #[ cfg( feature = "extension_inference" ) ]
508
517
#[ test]
509
518
/// A wire with extension requirements `[A]` and another with requirements
510
519
/// `[BOOL_T]` are both wired into a node which requires its inputs to have
@@ -558,6 +567,7 @@ fn extensions_mismatch() -> Result<(), BuildError> {
558
567
Ok ( ( ) )
559
568
}
560
569
570
+ #[ cfg( feature = "extension_inference" ) ]
561
571
#[ test]
562
572
fn parent_signature_mismatch ( ) -> Result < ( ) , BuildError > {
563
573
let rs = ExtensionSet :: singleton ( & XA ) ;
@@ -740,6 +750,7 @@ fn invalid_types() {
740
750
) ;
741
751
}
742
752
753
+ #[ cfg( feature = "extension_inference" ) ]
743
754
#[ test]
744
755
fn parent_io_mismatch ( ) {
745
756
// The DFG node declares that it has an empty extension delta,
0 commit comments