Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 0 additions & 27 deletions dag/gunbc/v1_interpreter_primitive_surface.dag
Original file line number Diff line number Diff line change
Expand Up @@ -1543,15 +1543,6 @@ fn v1_interpreter_authored_roster_arms() -> List<InterpreterPrimitiveDispatchArm
dispatch_emit_site: EvalAlgebraMethodInnerSite,
enumeration: AuthoredInRoster,
},
InterpreterPrimitiveDispatchArm {
arm: InterpreterPrimitiveArmId { identity: "method_call.contains" },
form: MethodCall,
authored_spelling: "has",
realization_module: "v1_interpreter",
dispatch_symbol: "eval_algebra_method_inner",
dispatch_emit_site: EvalAlgebraMethodInnerSite,
enumeration: AuthoredInRoster,
},
InterpreterPrimitiveDispatchArm {
arm: InterpreterPrimitiveArmId { identity: "method_call.join" },
form: MethodCall,
Expand Down Expand Up @@ -1660,24 +1651,6 @@ fn v1_interpreter_authored_roster_arms() -> List<InterpreterPrimitiveDispatchArm
dispatch_emit_site: EvalAlgebraMethodInnerSite,
enumeration: AuthoredInRoster,
},
InterpreterPrimitiveDispatchArm {
arm: InterpreterPrimitiveArmId { identity: "method_call.keys" },
form: MethodCall,
authored_spelling: "keys",
realization_module: "v1_interpreter",
dispatch_symbol: "eval_algebra_method_inner",
dispatch_emit_site: EvalAlgebraMethodInnerSite,
enumeration: AuthoredInRoster,
},
InterpreterPrimitiveDispatchArm {
arm: InterpreterPrimitiveArmId { identity: "method_call.values" },
form: MethodCall,
authored_spelling: "values",
realization_module: "v1_interpreter",
dispatch_symbol: "eval_algebra_method_inner",
dispatch_emit_site: EvalAlgebraMethodInnerSite,
enumeration: AuthoredInRoster,
},
InterpreterPrimitiveDispatchArm {
arm: InterpreterPrimitiveArmId { identity: "method_call.replace" },
form: MethodCall,
Expand Down
9 changes: 3 additions & 6 deletions dag/std/algebra.dag
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ type PartialFunction<K, V> {
get: fn(K) -> V?
insert: fn(K, V) -> PartialFunction<K, V>
merge: fn(PartialFunction<K, V>) -> PartialFunction<K, V>
keys: fn() -> FreeMonoid<K>
values: fn() -> FreeMonoid<V>
has: fn(K) -> Bool
map_keys: fn() -> FreeMonoid<K>
map_values: fn() -> FreeMonoid<V>
map_has: fn(K) -> Bool
contains_key: fn(K) -> Bool
size: fn() -> Int
}
Expand Down Expand Up @@ -351,12 +351,9 @@ fn partial_function_templates() -> List<AlgebraFieldTemplate> {
{ name: "lookup", param_types: [ReceiverSelf, ReceiverKey], return_type: OptionalOf { inner: ReceiverValue }, size_effect: none, cost_shape: none, callback_element_position: none },
{ name: "map_insert", param_types: [ReceiverSelf, ReceiverKey, ReceiverValue], return_type: ReceiverSelf, size_effect: none, cost_shape: none, callback_element_position: none },
{ name: "map_merge", param_types: [ReceiverSelf, ReceiverSelf], return_type: ReceiverSelf, size_effect: none, cost_shape: none, callback_element_position: none },
{ name: "has", param_types: [ReceiverSelf, ReceiverKey], return_type: NamedTemplate { name: "Bool" }, size_effect: none, cost_shape: none, callback_element_position: none },
{ name: "map_has", param_types: [ReceiverSelf, ReceiverKey], return_type: NamedTemplate { name: "Bool" }, size_effect: none, cost_shape: none, callback_element_position: none },
{ name: "map_contains_key", param_types: [ReceiverSelf, ReceiverKey], return_type: NamedTemplate { name: "Bool" }, size_effect: none, cost_shape: none, callback_element_position: none },
{ name: "keys", param_types: [ReceiverSelf], return_type: ContainerOf { source: Named { name: "List" }, element: ReceiverKey }, size_effect: none, cost_shape: none, callback_element_position: none },
{ name: "map_keys", param_types: [ReceiverSelf], return_type: ContainerOf { source: Named { name: "List" }, element: ReceiverKey }, size_effect: none, cost_shape: none, callback_element_position: none },
{ name: "values", param_types: [ReceiverSelf], return_type: ContainerOf { source: Named { name: "List" }, element: ReceiverValue }, size_effect: none, cost_shape: none, callback_element_position: none },
{ name: "map_values", param_types: [ReceiverSelf], return_type: ContainerOf { source: Named { name: "List" }, element: ReceiverValue }, size_effect: none, cost_shape: none, callback_element_position: none },
{ name: "with", param_types: [ReceiverSelf, ReceiverKey, ReceiverValue], return_type: ReceiverSelf, size_effect: none, cost_shape: none, callback_element_position: none },
{ name: "contains", param_types: [ReceiverSelf, ReceiverKey], return_type: NamedTemplate { name: "Bool" }, size_effect: none, cost_shape: none, callback_element_position: none },
Expand Down
3 changes: 0 additions & 3 deletions dag/std/methods.dag
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ data first_method: MethodDeclaration = { name: "first" }
data flat_map_method: MethodDeclaration = { name: "flat_map" }
data fold_method: MethodDeclaration = { name: "fold" }
data get_method: MethodDeclaration = { name: "get" }
data has_method: MethodDeclaration = { name: "has" }
data intersect_method: MethodDeclaration = { name: "intersect" }
data is_empty_method: MethodDeclaration = { name: "is_empty" }
data join_method: MethodDeclaration = { name: "join" }
data keys_method: MethodDeclaration = { name: "keys" }
data last_method: MethodDeclaration = { name: "last" }
data length_method: MethodDeclaration = { name: "length" }
data list_push_method: MethodDeclaration = { name: "list_push" }
Expand Down Expand Up @@ -64,6 +62,5 @@ data to_upper_method: MethodDeclaration = { name: "to_upper" }
data top_method: MethodDeclaration = { name: "top" }
data trim_method: MethodDeclaration = { name: "trim" }
data union_method: MethodDeclaration = { name: "union" }
data values_method: MethodDeclaration = { name: "values" }
data with_method: MethodDeclaration = { name: "with" }
data zero_method: MethodDeclaration = { name: "zero" }
45 changes: 3 additions & 42 deletions src/v1/stage0/src/std_algebra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ pub struct PartialFunction<K, V> {
pub get: Rc<dyn Fn(K) -> Option<V>>,
pub insert: Rc<dyn Fn(K, V) -> Rc<PartialFunction<K, V>>>,
pub merge: Rc<dyn Fn(Rc<PartialFunction<K, V>>) -> Rc<PartialFunction<K, V>>>,
pub keys: Rc<dyn Fn() -> Rc<FreeMonoid<K>>>,
pub values: Rc<dyn Fn() -> Rc<FreeMonoid<V>>>,
pub has: Rc<dyn Fn(K) -> bool>,
pub map_keys: Rc<dyn Fn() -> Rc<FreeMonoid<K>>>,
pub map_values: Rc<dyn Fn() -> Rc<FreeMonoid<V>>>,
pub map_has: Rc<dyn Fn(K) -> bool>,
pub contains_key: Rc<dyn Fn(K) -> bool>,
pub size: Rc<dyn Fn() -> i64>,
pub _phantom: std::marker::PhantomData<(K, V)>,
Expand Down Expand Up @@ -1478,19 +1478,6 @@ pub fn partial_function_templates() -> Rc<Vec<Rc<AlgebraFieldTemplate>>> {
cost_shape: None,
callback_element_position: None,
}),
Rc::new(AlgebraFieldTemplate {
name: "has".to_string(),
param_types: Rc::new(vec![
Rc::new(AlgebraTypeTemplate::ReceiverSelf),
Rc::new(AlgebraTypeTemplate::ReceiverKey),
]),
return_type: Rc::new(AlgebraTypeTemplate::NamedTemplate {
name: "Bool".to_string(),
}),
size_effect: None,
cost_shape: None,
callback_element_position: None,
}),
Rc::new(AlgebraFieldTemplate {
name: "map_has".to_string(),
param_types: Rc::new(vec![
Expand All @@ -1517,19 +1504,6 @@ pub fn partial_function_templates() -> Rc<Vec<Rc<AlgebraFieldTemplate>>> {
cost_shape: None,
callback_element_position: None,
}),
Rc::new(AlgebraFieldTemplate {
name: "keys".to_string(),
param_types: Rc::new(vec![Rc::new(AlgebraTypeTemplate::ReceiverSelf)]),
return_type: Rc::new(AlgebraTypeTemplate::ContainerOf {
source: Rc::new(ContainerSource::Named {
name: "List".to_string(),
}),
element: Rc::new(AlgebraTypeTemplate::ReceiverKey),
}),
size_effect: None,
cost_shape: None,
callback_element_position: None,
}),
Rc::new(AlgebraFieldTemplate {
name: "map_keys".to_string(),
param_types: Rc::new(vec![Rc::new(AlgebraTypeTemplate::ReceiverSelf)]),
Expand All @@ -1543,19 +1517,6 @@ pub fn partial_function_templates() -> Rc<Vec<Rc<AlgebraFieldTemplate>>> {
cost_shape: None,
callback_element_position: None,
}),
Rc::new(AlgebraFieldTemplate {
name: "values".to_string(),
param_types: Rc::new(vec![Rc::new(AlgebraTypeTemplate::ReceiverSelf)]),
return_type: Rc::new(AlgebraTypeTemplate::ContainerOf {
source: Rc::new(ContainerSource::Named {
name: "List".to_string(),
}),
element: Rc::new(AlgebraTypeTemplate::ReceiverValue),
}),
size_effect: None,
cost_shape: None,
callback_element_position: None,
}),
Rc::new(AlgebraFieldTemplate {
name: "map_values".to_string(),
param_types: Rc::new(vec![Rc::new(AlgebraTypeTemplate::ReceiverSelf)]),
Expand Down
14 changes: 1 addition & 13 deletions src/v1/stage0/src/v1_interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7415,7 +7415,7 @@ macro_rules! v1_algebra_method_arms {
Ok(list_value((result)))
},

arm "method_call.contains" { "contains" | "has" } => match &$receiver {
arm "method_call.contains" { "contains" } => match &$receiver {
Value::Map(m) => {
let key = $args.first().ok_or_else(|| InterpError::TypeError {
msg: "contains requires a key argument".to_string(),
Expand Down Expand Up @@ -7547,18 +7547,6 @@ macro_rules! v1_algebra_method_arms {
Ok(map_value((*overlay).clone().union((*base).clone())))
},

arm "method_call.keys" { "keys" } => {
let m = expect_map(&$receiver, "keys")?;
let keys: Vec<Value> = m.keys().map(|k| k.key.clone()).collect();
Ok(list_value((keys)))
},

arm "method_call.values" { "values" } => {
let m = expect_map(&$receiver, "values")?;
let vals: Vec<Value> = m.values().cloned().collect();
Ok(list_value((vals)))
},

arm "method_call.replace" { "replace" } => {
let s = expect_string(&$receiver, "replace")?;
match $args {
Expand Down
7 changes: 0 additions & 7 deletions src/v1/stage0/src/v1_interpreter_dispatch_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,6 @@ pub enum EvalAlgebraMethodArm {
MethodCallMapIsEmpty,
MethodCallInsert,
MethodCallMerge,
MethodCallKeys,
MethodCallValues,
MethodCallReplace,
MethodCallSplit,
MethodCallTrim,
Expand Down Expand Up @@ -452,7 +450,6 @@ pub fn lookup_eval_algebra_method_inner(spelling: &str) -> Option<EvalAlgebraMet
"take" => Some(EvalAlgebraMethodArm::MethodCallTake),
"enumerate" => Some(EvalAlgebraMethodArm::MethodCallEnumerate),
"contains" => Some(EvalAlgebraMethodArm::MethodCallContains),
"has" => Some(EvalAlgebraMethodArm::MethodCallContains),
"join" => Some(EvalAlgebraMethodArm::MethodCallJoin),
"chars" => Some(EvalAlgebraMethodArm::MethodCallChars),
"map_get" => Some(EvalAlgebraMethodArm::MethodCallMapGet),
Expand All @@ -465,8 +462,6 @@ pub fn lookup_eval_algebra_method_inner(spelling: &str) -> Option<EvalAlgebraMet
"insert" => Some(EvalAlgebraMethodArm::MethodCallInsert),
"map_insert" => Some(EvalAlgebraMethodArm::MethodCallInsert),
"merge" => Some(EvalAlgebraMethodArm::MethodCallMerge),
"keys" => Some(EvalAlgebraMethodArm::MethodCallKeys),
"values" => Some(EvalAlgebraMethodArm::MethodCallValues),
"replace" => Some(EvalAlgebraMethodArm::MethodCallReplace),
"split" => Some(EvalAlgebraMethodArm::MethodCallSplit),
"trim" => Some(EvalAlgebraMethodArm::MethodCallTrim),
Expand Down Expand Up @@ -510,8 +505,6 @@ macro_rules! eval_algebra_method_inner_arm {
("method_call.map_is_empty") => { $crate::v1_interpreter_dispatch_generated::EvalAlgebraMethodArm::MethodCallMapIsEmpty };
("method_call.insert") => { $crate::v1_interpreter_dispatch_generated::EvalAlgebraMethodArm::MethodCallInsert };
("method_call.merge") => { $crate::v1_interpreter_dispatch_generated::EvalAlgebraMethodArm::MethodCallMerge };
("method_call.keys") => { $crate::v1_interpreter_dispatch_generated::EvalAlgebraMethodArm::MethodCallKeys };
("method_call.values") => { $crate::v1_interpreter_dispatch_generated::EvalAlgebraMethodArm::MethodCallValues };
("method_call.replace") => { $crate::v1_interpreter_dispatch_generated::EvalAlgebraMethodArm::MethodCallReplace };
("method_call.split") => { $crate::v1_interpreter_dispatch_generated::EvalAlgebraMethodArm::MethodCallSplit };
("method_call.trim") => { $crate::v1_interpreter_dispatch_generated::EvalAlgebraMethodArm::MethodCallTrim };
Expand Down
8 changes: 4 additions & 4 deletions src/v2/std/compilers/target_model.dag
Original file line number Diff line number Diff line change
Expand Up @@ -10134,14 +10134,14 @@ fn target_derive_supplemental_generic_bound_requirement_nodes_for_contract(
contract_authority: TargetDeriveSupplementalGenericBoundContractAuthority
) -> List<Node> {
fold_list(
xs: contract_authority.requirements.keys(),
xs: map_keys(contract_authority.requirements),
empty: Empty,
cons: fn(acc, representation_parameter) {
match contract_authority.requirements.lookup(representation_parameter) {
Absent => acc
Present { value: requirements } =>
fold_list(
xs: requirements.keys(),
xs: map_keys(requirements),
empty: acc,
cons: fn(requirement_acc, required_key) {
match requirements.lookup(required_key) {
Expand Down Expand Up @@ -10213,7 +10213,7 @@ fn target_representation_choice_parameters_bundle_node(
choice: TargetRepresentationChoice
) -> Node {
fold_list_node(
xs: choice.representation_parameters.keys(),
xs: map_keys(choice.representation_parameters),
item_node: target_model_type_atom_node
)
}
Expand All @@ -10223,7 +10223,7 @@ fn target_representation_choice_supplemental_generic_bound_contracts_bundle_node
) -> Node {
fold_list_node(
xs: fold_list(
xs: choice.supplemental_generic_bound_contracts.keys(),
xs: map_keys(choice.supplemental_generic_bound_contracts),
empty: Empty,
cons: fn(acc, derive_key) {
match choice.supplemental_generic_bound_contracts.lookup(derive_key) {
Expand Down
2 changes: 1 addition & 1 deletion src/v2/std/provenance.dag
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fn span_index_lookup(index: SpanIndex, id: OccurrenceId) -> Witness<OriginEvent>
fn span_index_merge(base: SpanIndex, incoming: SpanIndex) -> SpanIndex {
SpanIndex {
entries: fold_list(
xs: incoming.entries.keys(),
xs: map_keys(incoming.entries),
empty: base.entries,
cons: fn(acc, id) {
match acc.lookup(id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,11 @@ fn sgb_contract_has_single_requirement(
required_trait: ReprGroundingDeriveTrait,
authority: ExternalAuthority
) -> Bool {
count(contract.requirements.keys()) == 1
count(map_keys(contract.requirements)) == 1
&& match contract.requirements.lookup(representation_parameter) {
Absent => false
Present { value: requirements } =>
count(requirements.keys()) == 1
count(map_keys(requirements)) == 1
&& sgb_requirement_authority_matches(
contract: contract,
representation_parameter: representation_parameter,
Expand All @@ -449,15 +449,15 @@ fn sgb_contract_has_two_requirements(
second_trait: ReprGroundingDeriveTrait,
second_authority: ExternalAuthority
) -> Bool {
count(contract.requirements.keys()) == 2
count(map_keys(contract.requirements)) == 2
&& match contract.requirements.lookup(first_parameter) {
Absent => false
Present { value: first_requirements } =>
count(first_requirements.keys()) == 1
count(map_keys(first_requirements)) == 1
&& match contract.requirements.lookup(second_parameter) {
Absent => false
Present { value: second_requirements } =>
count(second_requirements.keys()) == 1
count(map_keys(second_requirements)) == 1
&& sgb_requirement_authority_matches(
contract: contract,
representation_parameter: first_parameter,
Expand All @@ -481,7 +481,7 @@ fn sgb_contract_is_explicit_empty(
) -> Bool {
contract.derive_trait == derive_trait
&& contract.authority == authority
&& count(contract.requirements.keys()) == 0
&& count(map_keys(contract.requirements)) == 0
}

fn sgb_hash_set_coverage_blocker_matches(
Expand Down