Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Lower collections extension #1720

Merged
merged 11 commits into from
Nov 27, 2024
5 changes: 5 additions & 0 deletions hugr-core/src/std_extensions/collections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ impl ListValue {
pub fn custom_type(&self) -> CustomType {
list_custom_type(self.1.clone())
}

/// Returns the values contained inside the `[ListValue]`.
pub fn get_contents(&self) -> &Vec<Value> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is more idomatic returning &[Value]. Not too bothered.

&self.0
}
}

impl TryHash for ListValue {
Expand Down
3 changes: 2 additions & 1 deletion hugr-llvm/src/emit/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use hugr_core::ops::handle::FuncID;
use hugr_core::std_extensions::arithmetic::{
conversions, float_ops, float_types, int_ops, int_types,
};
use hugr_core::std_extensions::logic;
use hugr_core::std_extensions::{collections, logic};
use hugr_core::types::TypeRow;
use hugr_core::{Hugr, HugrView};
use inkwell::module::Module;
Expand Down Expand Up @@ -153,6 +153,7 @@ impl SimpleHugrConfig {
float_ops::EXTENSION_ID,
conversions::EXTENSION_ID,
logic::EXTENSION_ID,
collections::EXTENSION_ID,
]),
),
)
Expand Down
1 change: 1 addition & 0 deletions hugr-llvm/src/extension.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod collections;
pub mod conversions;
pub mod float;
pub mod int;
Expand Down
Loading
Loading