Skip to content

Commit 9ea72ac

Browse files
committed
Add core. prefix to order hint metadata symbols.
1 parent 054f8d1 commit 9ea72ac

File tree

4 files changed

+26
-22
lines changed

4 files changed

+26
-22
lines changed

hugr-core/tests/snapshots/model__roundtrip_order.snap

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ expression: "roundtrip(include_str!(\"../../hugr-model/tests/fixtures/model-orde
44
---
55
(hugr 0)
66

7-
(import order_hint.order)
7+
(mod)
88

9-
(import order_hint.key)
9+
(import core.order_hint.key)
1010

1111
(import core.fn)
1212

13+
(import core.order_hint.order)
14+
1315
(import arithmetic.int.types.int)
1416

1517
(import arithmetic.int.ineg)
@@ -38,23 +40,23 @@ expression: "roundtrip(include_str!(\"../../hugr-model/tests/fixtures/model-orde
3840
arithmetic.int.types.int
3941
arithmetic.int.types.int]
4042
(ext)))
41-
(meta (order_hint.order 4 7))
42-
(meta (order_hint.order 5 6))
43-
(meta (order_hint.order 5 4))
44-
(meta (order_hint.order 6 7))
43+
(meta (core.order_hint.order 4 7))
44+
(meta (core.order_hint.order 5 6))
45+
(meta (core.order_hint.order 5 4))
46+
(meta (core.order_hint.order 6 7))
4547
(arithmetic.int.ineg [%0] [%4]
4648
(signature
4749
(core.fn [arithmetic.int.types.int] [arithmetic.int.types.int] (ext)))
48-
(meta (order_hint.key 4)))
50+
(meta (core.order_hint.key 4)))
4951
(arithmetic.int.ineg [%1] [%5]
5052
(signature
5153
(core.fn [arithmetic.int.types.int] [arithmetic.int.types.int] (ext)))
52-
(meta (order_hint.key 5)))
54+
(meta (core.order_hint.key 5)))
5355
(arithmetic.int.ineg [%2] [%6]
5456
(signature
5557
(core.fn [arithmetic.int.types.int] [arithmetic.int.types.int] (ext)))
56-
(meta (order_hint.key 6)))
58+
(meta (core.order_hint.key 6)))
5759
(arithmetic.int.ineg [%3] [%7]
5860
(signature
5961
(core.fn [arithmetic.int.types.int] [arithmetic.int.types.int] (ext)))
60-
(meta (order_hint.key 7)))))
62+
(meta (core.order_hint.key 7)))))

hugr-model/src/v0/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ pub const COMPAT_CONST_JSON: &str = "compat.const_json";
275275
///
276276
/// - **Parameter:** `?key : core.nat`
277277
/// - **Result:** `core.meta`
278-
pub const ORDER_HINT_KEY: &str = "order_hint.key";
278+
pub const ORDER_HINT_KEY: &str = "core.order_hint.key";
279279

280280
/// Metadata constructor for order hints.
281281
///
@@ -290,7 +290,7 @@ pub const ORDER_HINT_KEY: &str = "order_hint.key";
290290
/// - **Parameter:** `?before : core.nat`
291291
/// - **Parameter:** `?after : core.nat`
292292
/// - **Result:** `core.meta`
293-
pub const ORDER_HINT_ORDER: &str = "order_hint.order";
293+
pub const ORDER_HINT_ORDER: &str = "core.order_hint.order";
294294

295295
pub mod ast;
296296
pub mod binary;

hugr-model/tests/fixtures/model-order.edn

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
(hugr 0)
22

3+
(mod)
4+
35
(define-func main
46
(core.fn
57
[arithmetic.int.types.int
@@ -24,27 +26,27 @@
2426
arithmetic.int.types.int]
2527
(ext)))
2628

27-
(meta (order_hint.order 1 2))
28-
(meta (order_hint.order 1 0))
29-
(meta (order_hint.order 2 3))
30-
(meta (order_hint.order 0 3))
29+
(meta (core.order_hint.order 1 2))
30+
(meta (core.order_hint.order 1 0))
31+
(meta (core.order_hint.order 2 3))
32+
(meta (core.order_hint.order 0 3))
3133

3234
(arithmetic.int.ineg
3335
[%0] [%4]
3436
(signature (core.fn [arithmetic.int.types.int] [arithmetic.int.types.int] (ext)))
35-
(meta (order_hint.key 0)))
37+
(meta (core.order_hint.key 0)))
3638

3739
(arithmetic.int.ineg
3840
[%1] [%5]
3941
(signature (core.fn [arithmetic.int.types.int] [arithmetic.int.types.int] (ext)))
40-
(meta (order_hint.key 1)))
42+
(meta (core.order_hint.key 1)))
4143

4244
(arithmetic.int.ineg
4345
[%2] [%6]
4446
(signature (core.fn [arithmetic.int.types.int] [arithmetic.int.types.int] (ext)))
45-
(meta (order_hint.key 2)))
47+
(meta (core.order_hint.key 2)))
4648

4749
(arithmetic.int.ineg
4850
[%3] [%7]
4951
(signature (core.fn [arithmetic.int.types.int] [arithmetic.int.types.int] (ext)))
50-
(meta (order_hint.key 3)))))
52+
(meta (core.order_hint.key 3)))))

hugr-py/src/hugr/model/export.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def export_node(self, node: Node) -> model.Node | None:
7575

7676
# Add an order hint key to the node if necessary
7777
if _needs_order_key(self.hugr, node):
78-
meta.append(model.Apply("order_hint.key", [model.Literal(node.idx)]))
78+
meta.append(model.Apply("core.order_hint.key", [model.Literal(node.idx)]))
7979

8080
match node_data.op:
8181
case DFG() as op:
@@ -422,7 +422,7 @@ def export_region_dfg(self, node: Node) -> model.Region:
422422

423423
meta += [
424424
model.Apply(
425-
"order_hint.order",
425+
"core.order_hint.order",
426426
[model.Literal(child.idx), model.Literal(successor.idx)],
427427
)
428428
for successor in self.hugr.outgoing_order_links(child)

0 commit comments

Comments
 (0)