diff --git a/src/v2/compiler/manual/target_operation_grounding_emit_typescript_test.dag b/src/v2/compiler/manual/target_operation_grounding_emit_typescript_test.dag new file mode 100644 index 00000000000..ebdda66cbdb --- /dev/null +++ b/src/v2/compiler/manual/target_operation_grounding_emit_typescript_test.dag @@ -0,0 +1,235 @@ +module v2.test.manual.target_operation_grounding_emit_typescript + +import v2.std.compilers.target_model { + CanonicalOperation, + InfixToken, + IsLess, + IsLessOrEqual, + IsGreater, + IsGreaterOrEqual, + IsEqual, + IsNotEqual, + TargetModel, + TargetValueExpression, + canonical_operation_op_add, + canonical_operation_op_sub, + canonical_operation_op_mul, + canonical_operation_op_div, + canonical_operation_op_negate, + canonical_operation_op_and, + canonical_operation_op_or, + canonical_operation_op_not, + canonical_operation_op_lt, + canonical_operation_op_le, + canonical_operation_op_gt, + canonical_operation_op_ge, + canonical_operation_op_eq, + canonical_operation_op_ne, + canonical_operation_wire_matches_operation, + equality_predicate_accepts, + ordering_predicate_accepts, + target_model_canonical_operation_wire_node, + target_model_emit_transforms_empty, + target_operator_realization_node, + target_operator_realizations_catalog_node, + target_value_expression_binding_ref, + target_value_expression_primitive_apply, + target_value_expression_primitive_apply_to_concrete_tokens +} +import v2.compiler.translate { serialize_concrete_syntax_tokens_to_source_string } +import v2.extdeps.languages.typescript { + ts_lex_rule, + ts_mvp1_binding_spellings, + ts_value_expression_projection +} +import v2.std.compilers.lexing { LexRuleSet, LexRules, ModeledLexRules } +import v2.std.collection { List } +import v2.std.algebra { Equal, Greater, Less, Ordering, zip_eq } +import v2.std.diagnostic { Accepted, Outcome, Rejected, bind_outcome } +import v2.std.host_transport { target_emit_host_runtime_row_unconfigured } +import v2.std.logic { Bool } +import v2.std.node { Conj, Node, Symbol, SyntheticOccurrence, TypeNode } + +fn op_grounding_test_lex() -> LexRules { + ModeledLexRules { + root: LexRuleSet { + rules: [ + ts_lex_rule(token_class: ^op_grounding_token_plus, text: " + "), + ts_lex_rule(token_class: ^op_grounding_token_minus, text: " - "), + ts_lex_rule(token_class: ^op_grounding_token_lt, text: " < "), + ts_lex_rule(token_class: ^op_grounding_token_eqeq, text: " == ") + ] + } + } +} + +fn op_grounding_test_bundle() -> Node { + Node { + kind: TypeNode { connective: Conj }, + children: [], + occurrence_id: SyntheticOccurrence + } +} + +fn op_grounding_test_model() -> TargetModel { + TargetModel { + bundle: op_grounding_test_bundle(), + lex: op_grounding_test_lex(), + binding_spellings: ts_mvp1_binding_spellings(), + token_class_emit_transforms: target_model_emit_transforms_empty, + authority_source_text: "", + runtime_row: target_emit_host_runtime_row_unconfigured + } +} + +fn op_grounding_realization_row(operation: CanonicalOperation, token: Symbol) -> Node { + target_operator_realization_node( + operation: operation, + shape: InfixToken { token: token } + ) +} + +fn op_grounding_catalog() -> Node { + target_operator_realizations_catalog_node( + rows: [ + op_grounding_realization_row(operation: canonical_operation_op_sub(), token: ^op_grounding_token_minus), + op_grounding_realization_row(operation: canonical_operation_op_lt(), token: ^op_grounding_token_lt), + op_grounding_realization_row(operation: canonical_operation_op_eq(), token: ^op_grounding_token_eqeq) + ] + ) +} + +fn op_grounding_catalog_sub_mistoken() -> Node { + target_operator_realizations_catalog_node( + rows: [ + op_grounding_realization_row(operation: canonical_operation_op_sub(), token: ^op_grounding_token_plus) + ] + ) +} + +fn op_grounding_catalog_sub_only() -> Node { + target_operator_realizations_catalog_node( + rows: [ + op_grounding_realization_row(operation: canonical_operation_op_sub(), token: ^op_grounding_token_minus) + ] + ) +} + +fn op_grounding_binary_expr(operation: CanonicalOperation) -> TargetValueExpression { + target_value_expression_primitive_apply( + operation: operation, + operands: [ + target_value_expression_binding_ref(binding: ^ts_binding_param_x), + target_value_expression_binding_ref(binding: ^ts_binding_param_y) + ] + ) +} + +fn op_grounding_emit(operation: CanonicalOperation, catalog: Node) -> Outcome { + bind_outcome( + o: target_value_expression_primitive_apply_to_concrete_tokens( + expr: op_grounding_binary_expr(operation: operation), + projection: ts_value_expression_projection(), + catalog: catalog + ), + f: fn(tokens) { + serialize_concrete_syntax_tokens_to_source_string( + target: op_grounding_test_model(), + tokens: tokens + ) + } + ) +} + +test fn op_grounding_emits_subtraction() -> Bool { + match op_grounding_emit(operation: canonical_operation_op_sub(), catalog: op_grounding_catalog()) { + Accepted { value: s, diagnostics: _ } => s == "x - y" + Rejected { diagnostics: _ } => false + } +} + +test fn op_grounding_emits_less_than() -> Bool { + match op_grounding_emit(operation: canonical_operation_op_lt(), catalog: op_grounding_catalog()) { + Accepted { value: s, diagnostics: _ } => s == "x < y" + Rejected { diagnostics: _ } => false + } +} + +test fn op_grounding_emits_equality() -> Bool { + match op_grounding_emit(operation: canonical_operation_op_eq(), catalog: op_grounding_catalog()) { + Accepted { value: s, diagnostics: _ } => s == "x == y" + Rejected { diagnostics: _ } => false + } +} + +test fn op_grounding_wrong_token_discriminates() -> Bool { + match op_grounding_emit(operation: canonical_operation_op_sub(), catalog: op_grounding_catalog_sub_mistoken()) { + Accepted { value: s, diagnostics: _ } => (s == "x + y") && (s != "x - y") + Rejected { diagnostics: _ } => false + } +} + +test fn op_grounding_catalog_miss_rejects() -> Bool { + match op_grounding_emit(operation: canonical_operation_op_lt(), catalog: op_grounding_catalog_sub_only()) { + Rejected { diagnostics: _ } => true + Accepted { value: _, diagnostics: _ } => false + } +} + +fn op_grounding_wire_roundtrips(operation: CanonicalOperation) -> Bool { + canonical_operation_wire_matches_operation( + wire: target_model_canonical_operation_wire_node(operation: operation), + operation: operation + ) +} + +test fn op_grounding_wire_roundtrips_all() -> Bool { + op_grounding_wire_roundtrips(operation: canonical_operation_op_add()) && + op_grounding_wire_roundtrips(operation: canonical_operation_op_sub()) && + op_grounding_wire_roundtrips(operation: canonical_operation_op_mul()) && + op_grounding_wire_roundtrips(operation: canonical_operation_op_div()) && + op_grounding_wire_roundtrips(operation: canonical_operation_op_negate()) && + op_grounding_wire_roundtrips(operation: canonical_operation_op_and()) && + op_grounding_wire_roundtrips(operation: canonical_operation_op_or()) && + op_grounding_wire_roundtrips(operation: canonical_operation_op_not()) && + op_grounding_wire_roundtrips(operation: canonical_operation_op_lt()) && + op_grounding_wire_roundtrips(operation: canonical_operation_op_le()) && + op_grounding_wire_roundtrips(operation: canonical_operation_op_gt()) && + op_grounding_wire_roundtrips(operation: canonical_operation_op_ge()) && + op_grounding_wire_roundtrips(operation: canonical_operation_op_eq()) && + op_grounding_wire_roundtrips(operation: canonical_operation_op_ne()) +} + +fn op_grounding_wire_rejects(produced: CanonicalOperation, probed: CanonicalOperation) -> Bool { + canonical_operation_wire_matches_operation( + wire: target_model_canonical_operation_wire_node(operation: produced), + operation: probed + ) +} + +test fn op_grounding_wire_discriminates() -> Bool { + !op_grounding_wire_rejects(produced: canonical_operation_op_sub(), probed: canonical_operation_op_add()) && + !op_grounding_wire_rejects(produced: canonical_operation_op_lt(), probed: canonical_operation_op_gt()) && + !op_grounding_wire_rejects(produced: canonical_operation_op_le(), probed: canonical_operation_op_ge()) && + !op_grounding_wire_rejects(produced: canonical_operation_op_eq(), probed: canonical_operation_op_ne()) +} + +fn op_grounding_ordering_eq(a: Ordering, b: Ordering) -> Bool { + discriminant(v: a) == discriminant(v: b) +} + +fn op_grounding_ordering_list_eq(left: List, right: List) -> Bool { + zip_eq(a: left, b: right, eq: fn(x, y) { op_grounding_ordering_eq(a: x, b: y) }) +} + +test fn op_grounding_ordering_predicate_accepts_units() -> Bool { + op_grounding_ordering_list_eq(left: ordering_predicate_accepts(predicate: IsLess), right: [Less]) && + op_grounding_ordering_list_eq(left: ordering_predicate_accepts(predicate: IsLessOrEqual), right: [Less, Equal]) && + op_grounding_ordering_list_eq(left: ordering_predicate_accepts(predicate: IsGreater), right: [Greater]) && + op_grounding_ordering_list_eq(left: ordering_predicate_accepts(predicate: IsGreaterOrEqual), right: [Equal, Greater]) +} + +test fn op_grounding_equality_predicate_accepts_units() -> Bool { + (equality_predicate_accepts(predicate: IsEqual) == true) && + (equality_predicate_accepts(predicate: IsNotEqual) == false) +} diff --git a/src/v2/std/algebra.dag b/src/v2/std/algebra.dag index 3f3533ee488..1d3b4cfed60 100644 --- a/src/v2/std/algebra.dag +++ b/src/v2/std/algebra.dag @@ -66,6 +66,10 @@ type BooleanAlgebra { complement: fn(T) -> T } +type Equivalence { + eq: fn(T, T) -> Bool +} + type FreeMonoid = Empty | Cons { head: T, tail: FreeMonoid } @@ -579,6 +583,37 @@ fn boolean_algebra_node(inhabitant: Node) -> Node { ) } +fn bool_type_node() -> Node { + Node { + kind: TypeNode { connective: Disj }, + children: [ + Edge { label: Named { name: ^bool_variant_true }, target: algebra_empty_conj() }, + Edge { label: Named { name: ^bool_variant_false }, target: algebra_empty_conj() }, + ], + occurrence_id: SyntheticOccurrence +} +} + +fn equivalence_type_node(inhabitant: Node) -> Node { + Node { + kind: TypeNode { connective: Conj }, + children: [ + Edge { + label: Named { name: ^equivalence_field_eq }, + target: algebra_binary_fn_node(domain: inhabitant, codomain: bool_type_node()) + }, + ], + occurrence_id: SyntheticOccurrence +} +} + +fn equivalence_node(inhabitant: Node) -> Node { + algebra_inhabitance_node( + algebra: equivalence_type_node(inhabitant: inhabitant), + inhabitant: inhabitant + ) +} + fn free_monoid_node(inhabitant: Node) -> Node { algebra_inhabitance_node( algebra: free_monoid_type_node(inhabitant: inhabitant), diff --git a/src/v2/std/compilers/target_model.dag b/src/v2/std/compilers/target_model.dag index 9a0515ed0bf..6dfe547a6ec 100644 --- a/src/v2/std/compilers/target_model.dag +++ b/src/v2/std/compilers/target_model.dag @@ -3,6 +3,10 @@ module v2.std.compilers.target_model import v2.std.algebra { Cons, Empty, + Equal, + Greater, + Less, + Ordering, FreeMonoid, fold_list, fold_list_node, @@ -546,11 +550,98 @@ type TargetValueTemplate { node: Node } +type OrderingPredicate + = IsLess + | IsLessOrEqual + | IsGreater + | IsGreaterOrEqual + +type EqualityPredicate + = IsEqual + | IsNotEqual + type CanonicalOperation - = OpAdd { algebra_field: Symbol } + = AlgebraPrimitive { algebra_field: Symbol } + | AlgebraInverseCompose { binary_field: Symbol, inverse_field: Symbol } + | OrderingComparison { compare_field: Symbol, predicate: OrderingPredicate } + | EqualityComparison { eq_field: Symbol, predicate: EqualityPredicate } + +fn ordering_predicate_accepts(predicate: OrderingPredicate) -> List { + match predicate { + IsLess => [Less] + IsLessOrEqual => [Less, Equal] + IsGreater => [Greater] + IsGreaterOrEqual => [Equal, Greater] + } +} + +fn equality_predicate_accepts(predicate: EqualityPredicate) -> Bool { + match predicate { + IsEqual => true + IsNotEqual => false + } +} fn canonical_operation_op_add() -> CanonicalOperation { - OpAdd { algebra_field: ^ring_field_add } + AlgebraPrimitive { algebra_field: ^ring_field_add } +} + +fn canonical_operation_op_mul() -> CanonicalOperation { + AlgebraPrimitive { algebra_field: ^ring_field_mul } +} + +fn canonical_operation_op_negate() -> CanonicalOperation { + AlgebraPrimitive { algebra_field: ^group_field_inverse } +} + +fn canonical_operation_op_and() -> CanonicalOperation { + AlgebraPrimitive { algebra_field: ^lattice_field_meet } +} + +fn canonical_operation_op_or() -> CanonicalOperation { + AlgebraPrimitive { algebra_field: ^lattice_field_join } +} + +fn canonical_operation_op_not() -> CanonicalOperation { + AlgebraPrimitive { algebra_field: ^boolean_algebra_field_complement } +} + +fn canonical_operation_op_sub() -> CanonicalOperation { + AlgebraInverseCompose { + binary_field: ^ring_field_add, + inverse_field: ^group_field_inverse + } +} + +fn canonical_operation_op_div() -> CanonicalOperation { + AlgebraInverseCompose { + binary_field: ^ring_field_mul, + inverse_field: ^field_field_reciprocal + } +} + +fn canonical_operation_op_lt() -> CanonicalOperation { + OrderingComparison { compare_field: ^ordered_ring_field_compare, predicate: IsLess } +} + +fn canonical_operation_op_le() -> CanonicalOperation { + OrderingComparison { compare_field: ^ordered_ring_field_compare, predicate: IsLessOrEqual } +} + +fn canonical_operation_op_gt() -> CanonicalOperation { + OrderingComparison { compare_field: ^ordered_ring_field_compare, predicate: IsGreater } +} + +fn canonical_operation_op_ge() -> CanonicalOperation { + OrderingComparison { compare_field: ^ordered_ring_field_compare, predicate: IsGreaterOrEqual } +} + +fn canonical_operation_op_eq() -> CanonicalOperation { + EqualityComparison { eq_field: ^equivalence_field_eq, predicate: IsEqual } +} + +fn canonical_operation_op_ne() -> CanonicalOperation { + EqualityComparison { eq_field: ^equivalence_field_eq, predicate: IsNotEqual } } type TargetOperatorShape @@ -681,7 +772,10 @@ fn target_canonical_operation_wire_malformed_diagnostic(wire: Node) -> Diagnosti } } -fn target_model_canonical_operation_algebra_field_from_wire(wire: Node) -> Optional { +fn target_model_canonical_operation_atom_field_from_wire( + wire: Node, + field_name: Symbol +) -> Optional { match fold( wire.children, init: optional_absent(), @@ -691,7 +785,7 @@ fn target_model_canonical_operation_algebra_field_from_wire(wire: Node) -> Optio Absent => match edge.label { Named { name: n } => - if n == ^target_canonical_operation_field_algebra_field { + if n == field_name { match edge.target.kind { TypeNode { connective: Atom { identity: id } } => optional_present(value: id) @@ -710,11 +804,67 @@ fn target_model_canonical_operation_algebra_field_from_wire(wire: Node) -> Optio } } +fn ordering_predicate_wire_symbol(predicate: OrderingPredicate) -> Symbol { + match predicate { + IsLess => ^ordering_predicate_is_less + IsLessOrEqual => ^ordering_predicate_is_less_or_equal + IsGreater => ^ordering_predicate_is_greater + IsGreaterOrEqual => ^ordering_predicate_is_greater_or_equal + } +} + +fn ordering_predicate_from_wire_symbol(id: Symbol) -> Optional { + if id == ^ordering_predicate_is_less { + optional_present(value: IsLess) + } else { + if id == ^ordering_predicate_is_less_or_equal { + optional_present(value: IsLessOrEqual) + } else { + if id == ^ordering_predicate_is_greater { + optional_present(value: IsGreater) + } else { + if id == ^ordering_predicate_is_greater_or_equal { + optional_present(value: IsGreaterOrEqual) + } else { + optional_absent() + } + } + } + } +} + +fn ordering_predicate_equal(left: OrderingPredicate, right: OrderingPredicate) -> Bool { + ordering_predicate_wire_symbol(predicate: left) == ordering_predicate_wire_symbol(predicate: right) +} + +fn equality_predicate_wire_symbol(predicate: EqualityPredicate) -> Symbol { + match predicate { + IsEqual => ^equality_predicate_is_equal + IsNotEqual => ^equality_predicate_is_not_equal + } +} + +fn equality_predicate_from_wire_symbol(id: Symbol) -> Optional { + if id == ^equality_predicate_is_equal { + optional_present(value: IsEqual) + } else { + if id == ^equality_predicate_is_not_equal { + optional_present(value: IsNotEqual) + } else { + optional_absent() + } + } +} + +fn equality_predicate_equal(left: EqualityPredicate, right: EqualityPredicate) -> Bool { + equality_predicate_wire_symbol(predicate: left) == equality_predicate_wire_symbol(predicate: right) +} + fn target_model_canonical_operation_wire_node(operation: CanonicalOperation) -> Node { match operation { - OpAdd { algebra_field: f } => + AlgebraPrimitive { algebra_field: f } => Node { - kind: TypeNode { connective: Atom { identity: discriminant(v: OpAdd {}) } }, + kind: TypeNode { connective: Atom { identity: discriminant(v: AlgebraPrimitive {}) } }, children: [ target_model_named_edge( name: ^target_canonical_operation_field_algebra_field, @@ -723,6 +873,51 @@ fn target_model_canonical_operation_wire_node(operation: CanonicalOperation) -> ], occurrence_id: SyntheticOccurrence } + AlgebraInverseCompose { binary_field: b, inverse_field: i } => + Node { + kind: TypeNode { connective: Atom { identity: discriminant(v: AlgebraInverseCompose {}) } }, + children: [ + target_model_named_edge( + name: ^target_canonical_operation_field_binary_field, + target: target_model_type_atom_node(identity: b) + ), + target_model_named_edge( + name: ^target_canonical_operation_field_inverse_field, + target: target_model_type_atom_node(identity: i) + ) + ], + occurrence_id: SyntheticOccurrence + } + OrderingComparison { compare_field: c, predicate: p } => + Node { + kind: TypeNode { connective: Atom { identity: discriminant(v: OrderingComparison {}) } }, + children: [ + target_model_named_edge( + name: ^target_canonical_operation_field_compare_field, + target: target_model_type_atom_node(identity: c) + ), + target_model_named_edge( + name: ^target_canonical_operation_field_predicate, + target: target_model_type_atom_node(identity: ordering_predicate_wire_symbol(predicate: p)) + ) + ], + occurrence_id: SyntheticOccurrence + } + EqualityComparison { eq_field: e, predicate: p } => + Node { + kind: TypeNode { connective: Atom { identity: discriminant(v: EqualityComparison {}) } }, + children: [ + target_model_named_edge( + name: ^target_canonical_operation_field_eq_field, + target: target_model_type_atom_node(identity: e) + ), + target_model_named_edge( + name: ^target_canonical_operation_field_predicate, + target: target_model_type_atom_node(identity: equality_predicate_wire_symbol(predicate: p)) + ) + ], + occurrence_id: SyntheticOccurrence + } } } @@ -731,9 +926,36 @@ fn canonical_operation_equal( right: CanonicalOperation ) -> Bool { match left { - OpAdd { algebra_field: lf } => + AlgebraPrimitive { algebra_field: lf } => + match right { + AlgebraPrimitive { algebra_field: rf } => lf == rf + AlgebraInverseCompose { binary_field: _, inverse_field: _ } => false + OrderingComparison { compare_field: _, predicate: _ } => false + EqualityComparison { eq_field: _, predicate: _ } => false + } + AlgebraInverseCompose { binary_field: lb, inverse_field: li } => + match right { + AlgebraPrimitive { algebra_field: _ } => false + AlgebraInverseCompose { binary_field: rb, inverse_field: ri } => + lb == rb && li == ri + OrderingComparison { compare_field: _, predicate: _ } => false + EqualityComparison { eq_field: _, predicate: _ } => false + } + OrderingComparison { compare_field: lc, predicate: lp } => + match right { + AlgebraPrimitive { algebra_field: _ } => false + AlgebraInverseCompose { binary_field: _, inverse_field: _ } => false + OrderingComparison { compare_field: rc, predicate: rp } => + lc == rc && ordering_predicate_equal(left: lp, right: rp) + EqualityComparison { eq_field: _, predicate: _ } => false + } + EqualityComparison { eq_field: le, predicate: lp } => match right { - OpAdd { algebra_field: rf } => lf == rf + AlgebraPrimitive { algebra_field: _ } => false + AlgebraInverseCompose { binary_field: _, inverse_field: _ } => false + OrderingComparison { compare_field: _, predicate: _ } => false + EqualityComparison { eq_field: re, predicate: rp } => + le == re && equality_predicate_equal(left: lp, right: rp) } } } @@ -741,19 +963,123 @@ fn canonical_operation_equal( fn canonical_operation_from_wire_node(wire: Node) -> Outcome { match wire.kind { TypeNode { connective: Atom { identity: id } } => - if id == discriminant(v: OpAdd {}) { - match target_model_canonical_operation_algebra_field_from_wire(wire: wire) { + if id == discriminant(v: AlgebraPrimitive {}) { + match target_model_canonical_operation_atom_field_from_wire( + wire: wire, + field_name: ^target_canonical_operation_field_algebra_field + ) { Present { value: algebra_field } => - outcome_accepted(OpAdd { algebra_field: algebra_field }) + outcome_accepted(AlgebraPrimitive { algebra_field: algebra_field }) Absent => outcome_rejected( target_canonical_operation_wire_malformed_diagnostic(wire: wire) ) } } else { - outcome_rejected( - target_canonical_operation_wire_malformed_diagnostic(wire: wire) - ) + if id == discriminant(v: AlgebraInverseCompose {}) { + match target_model_canonical_operation_atom_field_from_wire( + wire: wire, + field_name: ^target_canonical_operation_field_binary_field + ) { + Present { value: binary_field } => + match target_model_canonical_operation_atom_field_from_wire( + wire: wire, + field_name: ^target_canonical_operation_field_inverse_field + ) { + Present { value: inverse_field } => + outcome_accepted( + AlgebraInverseCompose { + binary_field: binary_field, + inverse_field: inverse_field + } + ) + Absent => + outcome_rejected( + target_canonical_operation_wire_malformed_diagnostic(wire: wire) + ) + } + Absent => + outcome_rejected( + target_canonical_operation_wire_malformed_diagnostic(wire: wire) + ) + } + } else { + if id == discriminant(v: OrderingComparison {}) { + match target_model_canonical_operation_atom_field_from_wire( + wire: wire, + field_name: ^target_canonical_operation_field_compare_field + ) { + Present { value: compare_field } => + match target_model_canonical_operation_atom_field_from_wire( + wire: wire, + field_name: ^target_canonical_operation_field_predicate + ) { + Present { value: predicate_id } => + match ordering_predicate_from_wire_symbol(id: predicate_id) { + Present { value: predicate } => + outcome_accepted( + OrderingComparison { + compare_field: compare_field, + predicate: predicate + } + ) + Absent => + outcome_rejected( + target_canonical_operation_wire_malformed_diagnostic(wire: wire) + ) + } + Absent => + outcome_rejected( + target_canonical_operation_wire_malformed_diagnostic(wire: wire) + ) + } + Absent => + outcome_rejected( + target_canonical_operation_wire_malformed_diagnostic(wire: wire) + ) + } + } else { + if id == discriminant(v: EqualityComparison {}) { + match target_model_canonical_operation_atom_field_from_wire( + wire: wire, + field_name: ^target_canonical_operation_field_eq_field + ) { + Present { value: eq_field } => + match target_model_canonical_operation_atom_field_from_wire( + wire: wire, + field_name: ^target_canonical_operation_field_predicate + ) { + Present { value: predicate_id } => + match equality_predicate_from_wire_symbol(id: predicate_id) { + Present { value: predicate } => + outcome_accepted( + EqualityComparison { + eq_field: eq_field, + predicate: predicate + } + ) + Absent => + outcome_rejected( + target_canonical_operation_wire_malformed_diagnostic(wire: wire) + ) + } + Absent => + outcome_rejected( + target_canonical_operation_wire_malformed_diagnostic(wire: wire) + ) + } + Absent => + outcome_rejected( + target_canonical_operation_wire_malformed_diagnostic(wire: wire) + ) + } + } else { + outcome_rejected( + target_canonical_operation_wire_malformed_diagnostic(wire: wire) + ) + } + } + } } _ => outcome_rejected(