Skip to content

Commit

Permalink
Match argument order between array type and array constants.
Browse files Browse the repository at this point in the history
  • Loading branch information
zrho committed Jan 16, 2025
1 parent c2b3c01 commit 7b7bc0d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion hugr-core/src/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ impl<'a> Context<'a> {
});

let symbol = self.resolve_symbol(ArrayValue::CTR_NAME);
let args = self.bump.alloc_slice_copy(&[element_type, len, contents]);
let args = self.bump.alloc_slice_copy(&[len, element_type, contents]);
return self.make_term(model::Term::ApplyFull { symbol, args });
}

Expand Down
2 changes: 1 addition & 1 deletion hugr-core/src/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1366,7 +1366,7 @@ impl<'a> Context<'a> {

if symbol_name == ArrayValue::CTR_NAME {
let element_type_term =
args.first().ok_or(model::ModelError::TypeError(term_id))?;
args.get(1).ok_or(model::ModelError::TypeError(term_id))?;
let element_type = self.import_type(*element_type_term)?;

let contents = {
Expand Down
2 changes: 1 addition & 1 deletion hugr-core/tests/snapshots/model__roundtrip_const.snap
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ expression: "roundtrip(include_str!(\"../../hugr-model/tests/fixtures/model-cons
0
[(@
collections.array.const
(@ arithmetic.int.types.int 6)
5
(@ arithmetic.int.types.int 6)
[(@ arithmetic.int.const 6 1)
(@ arithmetic.int.const 6 2)
(@ arithmetic.int.const 6 3)
Expand Down
2 changes: 1 addition & 1 deletion hugr-model/tests/fixtures/model-const.edn
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
0
[(@
collections.array.const
(@ arithmetic.int.types.int 6)
5
(@ arithmetic.int.types.int 6)
[(@ arithmetic.int.const 6 1)
(@ arithmetic.int.const 6 2)
(@ arithmetic.int.const 6 3)
Expand Down

0 comments on commit 7b7bc0d

Please sign in to comment.