Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
dfc038b
Hide SeqPart stuff - some can be removed, not sure if we need rest
acl-cqc Dec 28, 2025
ce1d652
collect_signature_exts is monomorphic, Type::Function does not use
acl-cqc Dec 28, 2025
5bab2ec
import.rs: import_poly_func_type is used only monomorphically
acl-cqc Dec 28, 2025
0113579
import.rs: Explicit typeargs to import_type_row; inline singly-used i…
acl-cqc Dec 28, 2025
74d9a07
export.rs: use SumType::num_variants/get_variant, uniform across Unit…
acl-cqc Dec 28, 2025
0247266
refactor: rephrase root_checked/dfg.rs TypeBase<NoRV> -> Type
acl-cqc Dec 29, 2025
740e227
WIP add new Term variants, declare Type=Term, remove row_var.rs
acl-cqc Dec 20, 2025
d8b7d38
GeneralSum with cached Option<TypeBound>
acl-cqc Dec 21, 2025
1ccc7eb
Move Transformable clauses into Term + SumType
acl-cqc Dec 28, 2025
cda8762
TypeRow now stores Terms, deparametrize; move (dubious) TypeRV->Term …
acl-cqc Jan 1, 2026
2a462e8
Remove some defunct RV conversions from types.rs
acl-cqc Dec 21, 2025
9d327ea
SumType stores Vec<Term> not Term, so fixed #variants
acl-cqc Dec 28, 2025
d431be1
zap various conversions etc., handle Term::Variable in least_upper_bound
acl-cqc Jan 1, 2026
75fe99c
trait Substitutable
acl-cqc Dec 28, 2025
49e9637
Combine Type/Term ::validate
acl-cqc Dec 28, 2025
5cd9bcd
PolyFunc, Signature, also Extension + Reinstate least_upper_bound
acl-cqc Dec 28, 2025
158830d
import.rs: combine import_{type,term}; import_type_row == closed_list…
acl-cqc Dec 28, 2025
8fc6a40
export.rs
acl-cqc Dec 28, 2025
5e42791
Remove a bunch of serde
acl-cqc Dec 29, 2025
1283b24
Revert "Remove a bunch of serde"
acl-cqc Dec 29, 2025
6231e7d
extension resolution
acl-cqc Dec 28, 2025
3647822
more types.rs
acl-cqc Dec 28, 2025
62a9268
export.rs: generalize export_poly_func_type => export_symbol_params
acl-cqc Dec 29, 2025
aa91785
Rename Type::new_{=>runtime_}tuple
acl-cqc Jan 1, 2026
9a27f98
SumType::new_from_row and many others
acl-cqc Dec 28, 2025
6a95f9a
test Term->TypeRow, add /*more complex Term::try_into_list_elements*/…
acl-cqc Dec 28, 2025
ae39bca
poly_func.rs: split validate
acl-cqc Dec 28, 2025
7c1055a
serialize (to some extent)
acl-cqc Dec 29, 2025
591d0e9
check.rs
acl-cqc Dec 29, 2025
0dbae20
new_var_use takes impl Into<Term>
acl-cqc Dec 29, 2025
c990657
std_extensions (at least start on)
acl-cqc Dec 29, 2025
372a341
prelude.rs
acl-cqc Dec 29, 2025
af3d9e6
Remove AliasID and related
acl-cqc Dec 29, 2025
9ec8877
simple_replace
acl-cqc Dec 29, 2025
bffdddd
Fix check_term_type; fix+extend is_supertype
acl-cqc Dec 29, 2025
f1f4b57
TEMP TO REVERT remove dev-dep hugr-core -> hugr
acl-cqc Dec 29, 2025
23eeb8c
WIP hugr-core tests...almost compile, but problems with Arbitrary
acl-cqc Jan 1, 2026
a8174c9
Arbitrary for (Poly)FuncTypes
acl-cqc Dec 30, 2025
1ead319
fix test types.rs/as_option
acl-cqc Dec 30, 2025
8b810ca
Fix new_runtime_tuple
acl-cqc Dec 30, 2025
e8fe1a8
validate check_term_types the subtrees (RTSum/RTFunc) that check_term…
acl-cqc Dec 30, 2025
c1fe1b6
Fix no_outer_row_variables
acl-cqc Jan 1, 2026
b5bbcfd
fix prelude type errors
acl-cqc Dec 30, 2025
81d7fc5
move check_typevar_decl, remove bad assert
acl-cqc Dec 30, 2025
d3fb5c4
Change Display for Term::List
acl-cqc Dec 31, 2025
4bbff67
Fix extension_with_eval_parallel; polyfunc, type{_row,_param,s}, vali…
acl-cqc Jan 1, 2026
ca2d0e1
hugr-core test fixes
acl-cqc Jan 1, 2026
8f41bd2
Some serialization fixes but still many problems; [...] becoming Type…
acl-cqc Dec 31, 2025
f022c59
DISABLE check_{hugr,testing}_roundtrip as TEST WORKAROUND
acl-cqc Dec 31, 2025
78a6fab
hugr-passes...all compile, all tests passing
acl-cqc Jan 1, 2026
c8bda84
monomorphize/mangle_name: use different prefix for extension/function…
acl-cqc Dec 31, 2025
0446bb5
hugr-llvm and benches compile; hugr-llvm snapshots failing "legacy fo…
acl-cqc Jan 1, 2026
61444e4
FunctionType + GeneralSum checking (RIP new_from_row)
acl-cqc Jan 1, 2026
a84ce48
Sum bound is just TypeBound not Option
acl-cqc Jan 1, 2026
1e5e9f3
clippy
acl-cqc Jan 1, 2026
68fba45
splicing for sums + FuncValueType; no tests, but use (saving only 5 l…
acl-cqc Jan 1, 2026
57b8921
Revert "splicing for sums + FuncValueType; no tests, but use (saving …
acl-cqc Jan 1, 2026
64db4a7
Revert "TEMP TO REVERT remove dev-dep hugr-core -> hugr"
acl-cqc Jan 2, 2026
0066fdd
docs, remove TypeRow::new_from_list (is TryInto), reduce change
acl-cqc Jan 2, 2026
259b3a7
fix: CustomSerialized (consts)
acl-cqc Jan 23, 2026
e402a73
Fix some bad PolyFuncType's in serialize/test.rs
acl-cqc Jan 23, 2026
cc4c40e
better fix for constants, use serde_with
acl-cqc Jan 23, 2026
74bd0b1
even better, use serde_as
acl-cqc Jan 23, 2026
999e712
Revert "even better, use serde_as"
acl-cqc Jan 23, 2026
320ea5d
RIP PolyFuncTypeBase, have two separate structs and a macro
acl-cqc Jan 23, 2026
245b542
RIP FuncTypeBase, same way
acl-cqc Jan 23, 2026
0f06b92
Add ser_type_row for serializing a TypeRow of SerSimpleType...use for…
acl-cqc Jan 23, 2026
2164c3a
Try to serialize FuncValueType inputs/outputs like old TypeRowRVs
acl-cqc Jan 23, 2026
edf28b1
Redo Term->Vec<SerSimpleType> with serde_as
acl-cqc Jan 23, 2026
81c638e
Revert "Redo Term->Vec<SerSimpleType> with serde_as"
acl-cqc Jan 23, 2026
76d3392
Refactor out term_(from,to)_ssts, define ser_sum_rows -> fix*3
acl-cqc Jan 23, 2026
ecf0cfc
Serialize a bunch of OpType TypeRows correctly -> many fixes
acl-cqc Jan 23, 2026
de82507
serde_as SerTypeRow does TypeRow->Vec<SST> -> also Vec<TypeRow>s in c…
acl-cqc Jan 23, 2026
0b58e82
serde_as SerTypeRowRV + SerGenSum(Vec<Term>) -> fix cfg_edge_ordering
acl-cqc Jan 24, 2026
9306be6
Fix Arbitrary for Term; prop_roundtrip SIGABRTs now just FAIL
acl-cqc Jan 24, 2026
7692b4e
Add any_type; use new_unchecked, any::<(->Custom)Type> -> fix prop_ro…
acl-cqc Jan 24, 2026
b8b9a5d
REINSTATE check_{hugr,testing}_roundtrip ---> 18 fails
acl-cqc Jan 24, 2026
710641f
mod ser_type -> serde_as SerType, use for Option in SerTestingLatest:…
acl-cqc Jan 26, 2026
f3d91da
proptest + serialize the 'type' in AliasDefn
acl-cqc Jan 26, 2026
4252158
Restrict prop_roundtrip_type; Arbitrary+serde_as LoadConstant
acl-cqc Jan 26, 2026
f42da0a
FuncValueType: Arbitrary type or row var using SeqPart
acl-cqc Jan 26, 2026
029469b
remove todo
acl-cqc Jan 26, 2026
e4a9a15
move any_type into proptest_utils
acl-cqc Jan 26, 2026
9ebf211
Term::(new_list_concat->concat_lists) returns singleton - final fix, …
acl-cqc Jan 26, 2026
cd0a264
clippy
acl-cqc Jan 26, 2026
2e362d5
Redefine TypeRowRV as Term; only a couple of fixes needed (dropping I…
acl-cqc Jan 26, 2026
65eed1c
docs
acl-cqc Jan 26, 2026
e3089d7
rm SerTypeRow, directly impl (Des/S)erialize for TypeRow
acl-cqc Jan 26, 2026
ba34337
Remove trait Substitutable
acl-cqc Jan 27, 2026
e224c5b
Merge branch 'acl/no_1type_row' into HEAD
acl-cqc Jan 30, 2026
273b45b
clippy (inc 4*std::slice::from_ref)
acl-cqc Jan 30, 2026
536e511
docs
acl-cqc Jan 30, 2026
5c69585
update hugr-llvm snapshot updates...right
acl-cqc Jan 30, 2026
3601613
and some more
acl-cqc Jan 30, 2026
f85724a
Re-pub into_list/tuple_parts, new_list/tuple_from_parts, SeqPart
acl-cqc Jan 30, 2026
f5047be
Fix ops/constant.rs...no way to do serde_as SerType ??
acl-cqc Jan 30, 2026
f226d19
Rm commented-out from<TypeBase<RV>> for Term
acl-cqc Feb 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions hugr-core/src/builder/dataflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,15 +469,15 @@ pub(crate) mod test {
BuilderWiringError, CFGBuilder, DataflowSubContainer, ModuleBuilder, TailLoopBuilder,
endo_sig, inout_sig,
};
use crate::extension::SignatureError;

use crate::extension::prelude::{Noop, bool_t, qb_t, usize_t};
use crate::hugr::linking::{NameLinkingPolicy, NodeLinkingDirective, OnMultiDefn};
use crate::hugr::validate::InterGraphEdgeError;
use crate::metadata::Metadata;
use crate::ops::{FuncDecl, FuncDefn, OpParent, OpTag, OpTrait, Value, handle::NodeHandle};
use crate::std_extensions::logic::test::and_op;
use crate::types::type_param::TypeParam;
use crate::types::{EdgeKind, FuncValueType, RowVariable, Signature, Type, TypeBound, TypeRV};
use crate::types::type_param::{TermTypeError, TypeParam};
use crate::types::{EdgeKind, FuncValueType, Signature, Type, TypeBound, TypeRV};
use crate::utils::test_quantum_extension::h_gate;
use crate::{Wire, builder::test::n_identity, type_row};

Expand Down Expand Up @@ -930,23 +930,23 @@ pub(crate) mod test {
Signature::new(
[Type::new_function(FuncValueType::new(
[usize_t()],
[tv.clone()],
tv.clone(),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice example of where we go back on #2784: this "row variable" previously had to be written in square brackets so it could be placed as an element of a TypeRow, despite the variable standing for a list itself

))],
[],
),
),
)?;

// But cannot eval it...
let ev = e.instantiate_extension_op(
"eval",
[vec![usize_t().into()].into(), vec![tv.into()].into()],
);
let ev =
e.instantiate_extension_op("eval", [vec![usize_t()].into(), vec![tv.clone()].into()]);
assert_eq!(
ev,
Err(SignatureError::RowVarWhereTypeExpected {
var: RowVariable(0, TypeBound::Copyable)
})
Err(TermTypeError::TypeMismatch {
term: Box::new(tv),
type_: Box::new(TypeBound::Linear.into())
}
.into())
);
Ok(())
}
Expand Down
73 changes: 3 additions & 70 deletions hugr-core/src/builder/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ use crate::hugr::{
ValidationError, hugrmut::InsertedForest, internal::HugrMutInternals, views::HugrView,
};
use crate::ops;
use crate::ops::handle::{AliasID, FuncID, NodeHandle};
use crate::types::{PolyFuncType, Type, TypeBound};
use crate::ops::handle::{FuncID, NodeHandle};
use crate::types::PolyFuncType;
use crate::{Hugr, Node, Visibility, ops::FuncDefn};

use smol_str::SmolStr;

/// Builder for a HUGR module.
#[derive(Debug, Default, Clone, PartialEq)]
pub struct ModuleBuilder<T>(pub(super) T);
Expand Down Expand Up @@ -179,49 +177,6 @@ impl<T: AsMut<Hugr> + AsRef<Hugr>> ModuleBuilder<T> {
self.define_function_op(FuncDefn::new(name, signature))
}

/// Add a [`crate::ops::OpType::AliasDefn`] node and return a handle to the Alias.
///
/// # Errors
///
/// Error in adding [`crate::ops::OpType::AliasDefn`] child node.
pub fn add_alias_def(
&mut self,
name: impl Into<SmolStr>,
typ: Type,
) -> Result<AliasID<true>, BuildError> {
// TODO: add AliasDefn in other containers
// This is currently tricky as they are not connected to anything so do
// not appear in topological traversals.
// Could be fixed by removing single-entry requirement and sorting from
// every 0-input node.
let name: SmolStr = name.into();
let bound = typ.least_upper_bound();
let node = self.add_child_node(ops::AliasDefn {
name: name.clone(),
definition: typ,
});

Ok(AliasID::new(node, name, bound))
}

/// Add a [`crate::ops::OpType::AliasDecl`] node and return a handle to the Alias.
/// # Errors
///
/// Error in adding [`crate::ops::OpType::AliasDecl`] child node.
pub fn add_alias_declare(
&mut self,
name: impl Into<SmolStr>,
bound: TypeBound,
) -> Result<AliasID<false>, BuildError> {
let name: SmolStr = name.into();
let node = self.add_child_node(ops::AliasDecl {
name: name.clone(),
bound,
});

Ok(AliasID::new(node, name, bound))
}

/// Add some module-children of another Hugr to this module, with
/// linking directives specified explicitly by [Node].
///
Expand Down Expand Up @@ -260,7 +215,7 @@ mod test {
use cool_asserts::assert_matches;

use crate::builder::test::dfg_calling_defn_decl;
use crate::builder::{Dataflow, DataflowSubContainer, test::n_identity};
use crate::builder::{Dataflow, DataflowSubContainer};
use crate::extension::prelude::usize_t;
use crate::{hugr::linking::NodeLinkingDirective, ops::OpType, types::Signature};

Expand All @@ -285,28 +240,6 @@ mod test {
Ok(())
}

#[test]
fn simple_alias() -> Result<(), BuildError> {
let build_result = {
let mut module_builder = ModuleBuilder::new();

let qubit_state_type =
module_builder.add_alias_declare("qubit_state", TypeBound::Linear)?;

let f_build = module_builder.define_function(
"main",
Signature::new(
vec![qubit_state_type.get_alias_type()],
vec![qubit_state_type.get_alias_type()],
),
)?;
n_identity(f_build)?;
module_builder.finish_hugr()
};
assert_matches!(build_result, Ok(_));
Ok(())
}

#[test]
fn builder_from_existing() -> Result<(), BuildError> {
let hugr = Hugr::new();
Expand Down
Loading
Loading