File tree Expand file tree Collapse file tree 2 files changed +38
-1
lines changed
Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,43 @@ fn rotation_gate() {
188188 . assert_eq ( & circ) ;
189189}
190190
191+ #[ test]
192+ fn grouping_nested_callables ( ) {
193+ let circ = circuit_with_options (
194+ r"
195+ namespace Test {
196+ @EntryPoint()
197+ operation Main() : Unit {
198+ use q = Qubit();
199+ for i in 0..5 {
200+ Foo(q);
201+ }
202+ MResetZ(q);
203+ }
204+
205+ operation Foo(q: Qubit) : Unit {
206+ H(q);
207+ }
208+ }
209+ " ,
210+ Profile :: Unrestricted ,
211+ CircuitEntryPoint :: EntryPoint ,
212+ CircuitGenerationMethod :: ClassicalEval ,
213+ TracerConfig {
214+ max_operations : usize:: MAX ,
215+ source_locations : false ,
216+ group_by_scope : true ,
217+ } ,
218+ )
219+ . expect ( "circuit generation should succeed" ) ;
220+
221+ expect ! [ [ r#"
222+ q_0 ─ [ [Main] ─── [ [Foo] ─── H ──── H ──── H ──── H ──── H ──── H ──── ] ──── M ──── |0〉 ──── ] ──
223+ [ ╘══════════════ ] ══
224+ "# ] ]
225+ . assert_eq ( & circ. display_with_groups ( ) . to_string ( ) ) ;
226+ }
227+
191228#[ test]
192229fn classical_for_loop ( ) {
193230 let circ = circuit (
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ impl Tracer for CircuitTracer {
134134 }
135135
136136 fn is_stack_tracing_enabled ( & self ) -> bool {
137- self . config . source_locations
137+ self . config . source_locations || self . config . group_by_scope
138138 }
139139}
140140
You can’t perform that action at this time.
0 commit comments