From f9e97a7547ca455883897e92dadd14d32ed2c878 Mon Sep 17 00:00:00 2001 From: Lukas Heidemann Date: Wed, 6 Nov 2024 14:21:20 +0000 Subject: [PATCH] Improved test cases --- hugr-core/src/import.rs | 2 +- .../model__roundtrip_constraints.snap | 12 +++++++++--- .../tests/fixtures/model-constraints.edn | 18 ++++++++++++------ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/hugr-core/src/import.rs b/hugr-core/src/import.rs index 5b039291a2..27e8aeeca1 100644 --- a/hugr-core/src/import.rs +++ b/hugr-core/src/import.rs @@ -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 { match self.get_term(term_id)? { model::Term::Wildcard => Err(error_uninferred!("wildcard")), diff --git a/hugr-core/tests/snapshots/model__roundtrip_constraints.snap b/hugr-core/tests/snapshots/model__roundtrip_constraints.snap index c0f959094a..372a98a2f0 100644 --- a/hugr-core/tests/snapshots/model__roundtrip_constraints.snap +++ b/hugr-core/tests/snapshots/model__roundtrip_constraints.snap @@ -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)) diff --git a/hugr-model/tests/fixtures/model-constraints.edn b/hugr-model/tests/fixtures/model-constraints.edn index 9a232ab109..f1011cef7d 100644 --- a/hugr-model/tests/fixtures/model-constraints.edn +++ b/hugr-model/tests/fixtures/model-constraints.edn @@ -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))