Skip to content

Commit

Permalink
Improved test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
zrho committed Nov 6, 2024
1 parent 158edcf commit f9e97a7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion hugr-core/src/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ impl<'a> Context<'a> {
}
}

/// Import a `TypeArg` froma term that represents a static type or value.
/// Import a `TypeArg` from a term that represents a static type or value.
fn import_type_arg(&mut self, term_id: model::TermId) -> Result<TypeArg, ImportError> {
match self.get_term(term_id)? {
model::Term::Wildcard => Err(error_uninferred!("wildcard")),
Expand Down
12 changes: 9 additions & 3 deletions hugr-core/tests/snapshots/model__roundtrip_constraints.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ expression: "roundtrip(include_str!(\"../../hugr-model/tests/fixtures/model-cons
---
(hugr 0)

(declare-func foo.func
(declare-func array.replicate
(forall ?0 type)
(forall ?1 type)
(forall ?1 nat)
(where (copy ?0))
(where (discard ?0))
[?0 ?1] [?0 ?0 ?1] (ext))
[?0] [(@ array.Array ?0 ?1)] (ext))

(declare-func tuple.copy
(forall ?0 type)
(where (copy ?0))
(where (discard ?0))
[(@ foo.tuple ?0)] [(@ foo.tuple ?0) (@ foo.tuple ?0)] (ext))
18 changes: 12 additions & 6 deletions hugr-model/tests/fixtures/model-constraints.edn
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
(hugr 0)

(declare-func foo.func
(forall ?x type)
(forall ?y type)
(where (copy ?x))
(where (discard ?x))
[?x ?y] [?x ?x ?y]
(declare-func array.replicate
(forall ?t type)
(forall ?n nat)
(where (copy ?t))
(where (discard ?t))
[?t] [(@ array.Array ?t ?n)]
(ext))

(declare-func tuple.copy
(forall ?t type)
(where (copy ?t))
(where (discard ?t))
[(@ foo.tuple ?t)] [(@ foo.tuple ?t) (@ foo.tuple ?t)] (ext))

0 comments on commit f9e97a7

Please sign in to comment.