Skip to content

Commit 687c829

Browse files
authored
fix: Correct conversion of table::Term::Tuple to ast::Term (#2653)
Fixes #2652 .
1 parent a7ed401 commit 687c829

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

hugr-core/tests/snapshots/model__roundtrip_const.snap

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ expression: ast
3636
(core.fn [] [(core.adt [[] []]) (core.adt [[] []])])
3737
(dfg [] [%0 %1]
3838
(signature (core.fn [] [(core.adt [[] []]) (core.adt [[] []])]))
39-
((core.load_const (core.const.adt [[] []] _ 0 [])) [] [%0]
39+
((core.load_const (core.const.adt [[] []] _ 0 (tuple))) [] [%0]
4040
(signature (core.fn [] [(core.adt [[] []])])))
41-
((core.load_const (core.const.adt [[] []] _ 1 [])) [] [%1]
41+
((core.load_const (core.const.adt [[] []] _ 1 (tuple))) [] [%1]
4242
(signature (core.fn [] [(core.adt [[] []])])))))
4343

4444
(define-func
@@ -62,15 +62,16 @@ expression: ast
6262
arithmetic.float.types.float64]]
6363
_
6464
0
65-
[(collections.array.const
66-
5
67-
(arithmetic.int.types.int 6)
68-
[(arithmetic.int.const 6 1)
69-
(arithmetic.int.const 6 2)
70-
(arithmetic.int.const 6 3)
71-
(arithmetic.int.const 6 4)
72-
(arithmetic.int.const 6 5)])
73-
(arithmetic.float.const_f64 -3.0)]))
65+
(tuple
66+
(collections.array.const
67+
5
68+
(arithmetic.int.types.int 6)
69+
[(arithmetic.int.const 6 1)
70+
(arithmetic.int.const 6 2)
71+
(arithmetic.int.const 6 3)
72+
(arithmetic.int.const 6 4)
73+
(arithmetic.int.const 6 5)])
74+
(arithmetic.float.const_f64 -3.0))))
7475
[] [%0]
7576
(signature
7677
(core.fn

hugr-model/src/v0/ast/view.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ impl<'a> View<'a, TermId> for Term {
1717
table::Term::Func(region_id) => Term::Func(Arc::new(module.view(*region_id)?)),
1818
table::Term::List(list_parts) => Term::List(module.view(*list_parts)?),
1919
table::Term::Literal(literal) => Term::Literal(literal.clone()),
20-
table::Term::Tuple(tuple_parts) => Term::List(module.view(*tuple_parts)?),
20+
table::Term::Tuple(tuple_parts) => Term::Tuple(module.view(*tuple_parts)?),
2121
})
2222
}
2323
}

0 commit comments

Comments
 (0)